Class ReactorNettyTcpConnection<P>
java.lang.Object
org.springframework.messaging.tcp.reactor.ReactorNettyTcpConnection<P>
- Type Parameters:
P- the type of payload for outbound messages
- All Implemented Interfaces:
Closeable,AutoCloseable,TcpConnection<P>
Reactor Netty based implementation of
TcpConnection.- Since:
- 5.0
- Author:
- Rossen Stoyanchev
-
Constructor Summary
ConstructorsConstructorDescriptionReactorNettyTcpConnection(reactor.netty.NettyInbound inbound, reactor.netty.NettyOutbound outbound, ReactorNettyCodec<P> codec, reactor.core.publisher.Sinks.Empty<Void> completionSink) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the connection.voidonReadInactivity(Runnable runnable, long inactivityDuration) Register a task to invoke after a period of read inactivity.voidonWriteInactivity(Runnable runnable, long inactivityDuration) Register a task to invoke after a period of write inactivity.Send the given message.toString()
-
Constructor Details
-
ReactorNettyTcpConnection
public ReactorNettyTcpConnection(reactor.netty.NettyInbound inbound, reactor.netty.NettyOutbound outbound, ReactorNettyCodec<P> codec, reactor.core.publisher.Sinks.Empty<Void> completionSink)
-
-
Method Details
-
sendAsync
Description copied from interface:TcpConnectionSend the given message.- Specified by:
sendAsyncin interfaceTcpConnection<P>- Parameters:
message- the message- Returns:
- a CompletableFuture that can be used to determine when and if the message was successfully sent
-
onReadInactivity
Description copied from interface:TcpConnectionRegister a task to invoke after a period of read inactivity.- Specified by:
onReadInactivityin interfaceTcpConnection<P>- Parameters:
runnable- the task to invokeinactivityDuration- the amount of inactive time in milliseconds
-
onWriteInactivity
Description copied from interface:TcpConnectionRegister a task to invoke after a period of write inactivity.- Specified by:
onWriteInactivityin interfaceTcpConnection<P>- Parameters:
runnable- the task to invokeinactivityDuration- the amount of inactive time in milliseconds
-
close
public void close()Description copied from interface:TcpConnectionClose the connection.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceTcpConnection<P>
-
toString
-