Top Description Fields Constructors Methods
org.springframework.messaging.tcp.reactor

public Class ReactorNetty2TcpConnection<P>

extends Object
implements TcpConnection<P>
Class Inheritance
All Implemented Interfaces
org.springframework.messaging.tcp.TcpConnection, java.io.Closeable, java.lang.AutoCloseable
Type Parameters
<P>
the type of payload for outbound messages
Imports
java.nio.ByteBuffer, java.util.concurrent.CompletableFuture, io.netty5.buffer.Buffer, reactor.core.publisher.Mono, .Sinks, reactor.netty5.NettyInbound, .NettyOutbound, org.springframework.messaging.Message, org.springframework.messaging.tcp.TcpConnection

Reactor Netty based implementation of TcpConnection.

This class is based on ReactorNettyTcpConnection.

Author
Rossen Stoyanchev
Since
6.0

Field Summary

Modifier and TypeField and Description
private final TcpMessageCodec<P>
private final Sinks.Empty<Void>
private final NettyInbound
private final NettyOutbound

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public void
onReadInactivity(Runnable
the task to invoke
runnable
,
long
the amount of inactive time in milliseconds
inactivityDuration
)

Implements org.springframework.messaging.tcp.TcpConnection.onReadInactivity.

Register a task to invoke after a period of read inactivity.

public void
onWriteInactivity(Runnable
the task to invoke
runnable
,
long
the amount of inactive time in milliseconds
inactivityDuration
)

Implements org.springframework.messaging.tcp.TcpConnection.onWriteInactivity.

Register a task to invoke after a period of write inactivity.

public CompletableFuture<Void>
sendAsync(Message<P>
the message
message
)

Implements org.springframework.messaging.tcp.TcpConnection.sendAsync.

Send the given message.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

codecback to summary
private final TcpMessageCodec<P> codec
completionSinkback to summary
private final Sinks.Empty<Void> completionSink
inboundback to summary
private final NettyInbound inbound
outboundback to summary
private final NettyOutbound outbound

Constructor Detail

ReactorNetty2TcpConnectionback to summary
public ReactorNetty2TcpConnection(NettyInbound inbound, NettyOutbound outbound, TcpMessageCodec<P> codec, Sinks.Empty<Void> completionSink)

Method Detail

closeback to summary
public void close()

Implements org.springframework.messaging.tcp.TcpConnection.close.

Doc from org.springframework.messaging.tcp.TcpConnection.close.

Close the connection.

Annotations
@Override
onReadInactivityback to summary
public void onReadInactivity(Runnable runnable, long inactivityDuration)

Implements org.springframework.messaging.tcp.TcpConnection.onReadInactivity.

Doc from org.springframework.messaging.tcp.TcpConnection.onReadInactivity.

Register a task to invoke after a period of read inactivity.

Parameters
runnable:Runnable

the task to invoke

inactivityDuration:long

the amount of inactive time in milliseconds

Annotations
@Override
onWriteInactivityback to summary
public void onWriteInactivity(Runnable runnable, long inactivityDuration)

Implements org.springframework.messaging.tcp.TcpConnection.onWriteInactivity.

Doc from org.springframework.messaging.tcp.TcpConnection.onWriteInactivity.

Register a task to invoke after a period of write inactivity.

Parameters
runnable:Runnable

the task to invoke

inactivityDuration:long

the amount of inactive time in milliseconds

Annotations
@Override
sendAsyncback to summary
public CompletableFuture<Void> sendAsync(Message<P> message)

Implements org.springframework.messaging.tcp.TcpConnection.sendAsync.

Doc from org.springframework.messaging.tcp.TcpConnection.sendAsync.

Send the given message.

Parameters
message:Message<P>

the message

Returns:CompletableFuture<Void>

a CompletableFuture that can be used to determine when and if the message was successfully sent

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override