Top Description Methods
org.springframework.messaging.tcp

public Interface TcpConnection<P>

extends Closeable
Known Direct Implementers
org.springframework.messaging.tcp.reactor.ReactorNetty2TcpConnection, org.springframework.messaging.tcp.reactor.ReactorNettyTcpConnection
Type Parameters
<P>
the type of payload for outbound Messages
Imports
java.io.Closeable, java.util.concurrent.CompletableFuture, org.springframework.messaging.Message

A contract for sending messages and managing a TCP connection.
Author
Rossen Stoyanchev
Since
4.0

Method Summary

Modifier and TypeMethod and Description
public void
close()

Redeclares java.io.Closeable.close.

Close the connection.

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

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
duration
)

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

public default ListenableFuture<Void>

Returns:

a ListenableFuture that can be used to determine when and if the message was successfully sent
send
(Message<P>
the message
message
)
Deprecated since 6.0. as of 6.0, in favor of sendAsync(Message)

Send the given message.

public CompletableFuture<Void>

Returns:

a CompletableFuture that can be used to determine when and if the message was successfully sent
sendAsync
(Message<P>
the message
message
)

Send the given message.

Method Detail

closeback to summary
public void close()

Redeclares java.io.Closeable.close.

Close the connection.

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

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

Parameters
runnable:Runnable

the task to invoke

duration:long

the amount of inactive time in milliseconds

onWriteInactivityback to summary
public void onWriteInactivity(Runnable runnable, long duration)

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

Parameters
runnable:Runnable

the task to invoke

duration:long

the amount of inactive time in milliseconds

sendback to summary
public default ListenableFuture<Void> send(Message<P> message)

Deprecated

since 6.0.

as of 6.0, in favor of sendAsync(Message)

Send the given message.

Parameters
message:Message<P>

the message

Returns:ListenableFuture<Void>

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

Annotations
@Deprecated
since:6.0
sendAsyncback to summary
public CompletableFuture<Void> sendAsync(Message<P> message)

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

Since
6.0