Interface TcpConnection<P>

Type Parameters:
P - the type of payload for outbound Messages
All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
ReactorNetty2TcpConnection, ReactorNettyTcpConnection

public interface TcpConnection<P> extends Closeable
A contract for sending messages and managing a TCP connection.
Since:
4.0
Author:
Rossen Stoyanchev
  • Method Details

    • sendAsync

      CompletableFuture<Void> sendAsync(Message<P> message)
      Send the given message.
      Parameters:
      message - the message
      Returns:
      a CompletableFuture that can be used to determine when and if the message was successfully sent
      Since:
      6.0
    • onReadInactivity

      void onReadInactivity(Runnable runnable, long duration)
      Register a task to invoke after a period of read inactivity.
      Parameters:
      runnable - the task to invoke
      duration - the amount of inactive time in milliseconds
    • onWriteInactivity

      void onWriteInactivity(Runnable runnable, long duration)
      Register a task to invoke after a period of write inactivity.
      Parameters:
      runnable - the task to invoke
      duration - the amount of inactive time in milliseconds
    • close

      void close()
      Close the connection.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable