spring-framework / org.springframework.messaging.simp.stomp / ReactorNettyTcpStompClient

ReactorNettyTcpStompClient

open class ReactorNettyTcpStompClient : StompClientSupport

A STOMP over TCP client that uses ReactorNettyTcpClient.

Author
Rossen Stoyanchev

Since
5.0

Constructors

<init>

ReactorNettyTcpStompClient()

Create an instance with host "127.0.0.1" and port 61613.

ReactorNettyTcpStompClient(host: String, port: Int)

Create an instance with the given host and port.

ReactorNettyTcpStompClient(tcpClient: TcpOperations<ByteArray>)

Create an instance with a pre-configured TCP client.

Functions

connect

open fun connect(handler: StompSessionHandler): ListenableFuture<StompSession>

Connect and notify the given StompSessionHandler when connected on the STOMP level.

open fun connect(connectHeaders: StompHeaders, handler: StompSessionHandler): ListenableFuture<StompSession>

An overloaded version of #connect(StompSessionHandler) that accepts headers to use for the STOMP CONNECT frame.

shutdown

open fun shutdown(): Unit

Shut down the client and release resources.

Inherited Functions

getDefaultHeartbeat

open fun getDefaultHeartbeat(): LongArray

Return the configured default heart-beat value (never null).

getMessageConverter

open fun getMessageConverter(): MessageConverter

Return the configured MessageConverter.

getReceiptTimeLimit

open fun getReceiptTimeLimit(): Long

Return the configured receipt time limit.

getTaskScheduler

open fun getTaskScheduler(): TaskScheduler

The configured TaskScheduler.

isDefaultHeartbeatEnabled

open fun isDefaultHeartbeatEnabled(): Boolean

Determine whether heartbeats are enabled.

Returns false if defaultHeartbeat is set to "0,0", and true otherwise.

setDefaultHeartbeat

open fun setDefaultHeartbeat(heartbeat: LongArray): Unit

Configure the default value for the "heart-beat" header of the STOMP CONNECT frame. The first number represents how often the client will write or send a heart-beat. The second is how often the server should write. A value of 0 means no heart-beats.

By default this is set to "10000,10000" but subclasses may override that default and for example set it to "0,0" if they require a TaskScheduler to be configured first.

setMessageConverter

open fun setMessageConverter(messageConverter: MessageConverter): Unit

Set the MessageConverter to use to convert the payload of incoming and outgoing messages to and from byte[] based on object type and the "content-type" header.

By default, SimpleMessageConverter is configured.

setReceiptTimeLimit

open fun setReceiptTimeLimit(receiptTimeLimit: Long): Unit

Configure the number of milliseconds before a receipt is considered expired.

By default set to 15,000 (15 seconds).

setTaskScheduler

open fun setTaskScheduler(taskScheduler: TaskScheduler): Unit

Configure a scheduler to use for heartbeats and for receipt tracking.

Note: Some transports have built-in support to work with heartbeats and therefore do not require a TaskScheduler. Receipts however, if needed, do require a TaskScheduler to be configured.

By default, this is not set.