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>
public class ReactorNettyTcpConnection<P> extends Object implements TcpConnection<P>
Reactor Netty based implementation ofTcpConnection
.- Since:
- 5.0
- Author:
- Rossen Stoyanchev
Constructor Summary
Constructors Constructor Description ReactorNettyTcpConnection(reactor.netty.NettyInbound inbound, reactor.netty.NettyOutbound outbound, ReactorNettyCodec<P> codec, reactor.core.publisher.DirectProcessor<Void> closeProcessor)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the connection.void
onReadInactivity(Runnable runnable, long inactivityDuration)
Register a task to invoke after a period of read inactivity.void
onWriteInactivity(Runnable runnable, long inactivityDuration)
Register a task to invoke after a period of write inactivity.ListenableFuture<Void>
send(Message<P> message)
Send the given message.
Constructor Detail
ReactorNettyTcpConnection
public ReactorNettyTcpConnection(reactor.netty.NettyInbound inbound, reactor.netty.NettyOutbound outbound, ReactorNettyCodec<P> codec, reactor.core.publisher.DirectProcessor<Void> closeProcessor)
Method Detail
send
public ListenableFuture<Void> send(Message<P> message)
Description copied from interface:TcpConnection
Send the given message.- Specified by:
send
in interfaceTcpConnection<P>
- Parameters:
message
- the message- Returns:
- a ListenableFuture that can be used to determine when and if the message was successfully sent
onReadInactivity
public void onReadInactivity(Runnable runnable, long inactivityDuration)
Description copied from interface:TcpConnection
Register a task to invoke after a period of read inactivity.- Specified by:
onReadInactivity
in interfaceTcpConnection<P>
- Parameters:
runnable
- the task to invokeinactivityDuration
- the amount of inactive time in milliseconds
onWriteInactivity
public void onWriteInactivity(Runnable runnable, long inactivityDuration)
Description copied from interface:TcpConnection
Register a task to invoke after a period of write inactivity.- Specified by:
onWriteInactivity
in interfaceTcpConnection<P>
- Parameters:
runnable
- the task to invokeinactivityDuration
- the amount of inactive time in milliseconds
close
public void close()
Description copied from interface:TcpConnection
Close the connection.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceTcpConnection<P>