Top Description Fields Constructors Methods
org.springframework.messaging.simp.config

public Class StompBrokerRelayRegistration

extends AbstractBrokerRegistration
Class Inheritance
Imports
org.springframework.lang.Nullable, org.springframework.messaging.MessageChannel, .SubscribableChannel, org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler, org.springframework.messaging.tcp.TcpOperations, org.springframework.scheduling.TaskScheduler, org.springframework.util.Assert

Registration class for configuring a StompBrokerRelayMessageHandler.
Author
Rossen Stoyanchev
Since
4.0

Field Summary

Modifier and TypeField and Description
private boolean
private String
private String
private String
private int
private Long
private Long
private String
private String
private TaskScheduler
private TcpOperations<byte[]>
private String
private String
private String

Constructor Summary

AccessConstructor and Description
public
StompBrokerRelayRegistration(SubscribableChannel
the inbound channel
clientInboundChannel
,
MessageChannel
the outbound channel
clientOutboundChannel
,
String[]
the destination prefixes
destinationPrefixes
)

Create a new StompBrokerRelayRegistration.

Method Summary

Modifier and TypeMethod and Description
protected StompBrokerRelayMessageHandler
protected String
protected String
public StompBrokerRelayRegistration
setAutoStartup(boolean autoStartup)

Configure whether the StompBrokerRelayMessageHandler should start automatically when the Spring ApplicationContext is refreshed.

public StompBrokerRelayRegistration
setClientLogin(String login)

Set the login to use when creating connections to the STOMP broker on behalf of connected clients.

public StompBrokerRelayRegistration
setClientPasscode(String passcode)

Set the passcode to use when creating connections to the STOMP broker on behalf of connected clients.

public StompBrokerRelayRegistration
setRelayHost(String relayHost)

Set the STOMP message broker host.

public StompBrokerRelayRegistration
setRelayPort(int relayPort)

Set the STOMP message broker port.

public StompBrokerRelayRegistration
setSystemHeartbeatReceiveInterval(long heartbeatReceiveInterval)

Set the maximum interval, in milliseconds, at which the "system" relay session expects, in the absence of any other data, to receive a heartbeat from the STOMP broker.

public StompBrokerRelayRegistration
setSystemHeartbeatSendInterval(long systemHeartbeatSendInterval)

Set the interval, in milliseconds, at which the "system" relay session will, in the absence of any other data being sent, send a heartbeat to the STOMP broker.

public StompBrokerRelayRegistration
setSystemLogin(String login)

Set the login for the shared "system" connection used to send messages to the STOMP broker from within the application, i.e. messages not associated with a specific client session (e.g. REST/HTTP request handling method).

public StompBrokerRelayRegistration
setSystemPasscode(String passcode)

Set the passcode for the shared "system" connection used to send messages to the STOMP broker from within the application, i.e. messages not associated with a specific client session (e.g. REST/HTTP request handling method).

public StompBrokerRelayRegistration
setTaskScheduler(TaskScheduler taskScheduler)

Some STOMP clients (e.g. stomp-js) always send heartbeats at a fixed rate but others (Spring STOMP client) do so only when no other messages are sent.

public StompBrokerRelayRegistration
setTcpClient(TcpOperations<byte[]> tcpClient)

Configure a TCP client for managing TCP connections to the STOMP broker.

public StompBrokerRelayRegistration
setUserDestinationBroadcast(String
the destination to broadcast unresolved messages to, e.g. "/topic/unresolved-user-destination"
destination
)

Set a destination to broadcast messages to user destinations that remain unresolved because the user appears not to be connected.

public StompBrokerRelayRegistration
setUserRegistryBroadcast(String
the destination for broadcasting user registry details, e.g. "/topic/simp-user-registry".
destination
)

Set a destination to broadcast the content of the local user registry to and to listen for such broadcasts from other servers.

public StompBrokerRelayRegistration
setVirtualHost(String virtualHost)

Set the value of the "host" header to use in STOMP CONNECT frames.

Inherited from org.springframework.messaging.simp.config.AbstractBrokerRegistration:
getClientInboundChannelgetClientOutboundChannelgetDestinationPrefixes

Field Detail

autoStartupback to summary
private boolean autoStartup
clientLoginback to summary
private String clientLogin
clientPasscodeback to summary
private String clientPasscode
relayHostback to summary
private String relayHost
relayPortback to summary
private int relayPort
systemHeartbeatReceiveIntervalback to summary
private Long systemHeartbeatReceiveInterval
Annotations
@Nullable
systemHeartbeatSendIntervalback to summary
private Long systemHeartbeatSendInterval
Annotations
@Nullable
systemLoginback to summary
private String systemLogin
systemPasscodeback to summary
private String systemPasscode
taskSchedulerback to summary
private TaskScheduler taskScheduler
Annotations
@Nullable
tcpClientback to summary
private TcpOperations<byte[]> tcpClient
Annotations
@Nullable
userDestinationBroadcastback to summary
private String userDestinationBroadcast
Annotations
@Nullable
userRegistryBroadcastback to summary
private String userRegistryBroadcast
Annotations
@Nullable
virtualHostback to summary
private String virtualHost
Annotations
@Nullable

Constructor Detail

StompBrokerRelayRegistrationback to summary
public StompBrokerRelayRegistration(SubscribableChannel clientInboundChannel, MessageChannel clientOutboundChannel, String[] destinationPrefixes)

Create a new StompBrokerRelayRegistration.

Parameters
clientInboundChannel:SubscribableChannel

the inbound channel

clientOutboundChannel:MessageChannel

the outbound channel

destinationPrefixes:String[]

the destination prefixes

Method Detail

getMessageHandlerback to summary
protected StompBrokerRelayMessageHandler getMessageHandler(SubscribableChannel brokerChannel)

Implements abstract org.springframework.messaging.simp.config.AbstractBrokerRegistration.getMessageHandler.

Annotations
@Override
getUserDestinationBroadcastback to summary
protected String getUserDestinationBroadcast()
Annotations
@Nullable
getUserRegistryBroadcastback to summary
protected String getUserRegistryBroadcast()
Annotations
@Nullable
setAutoStartupback to summary
public StompBrokerRelayRegistration setAutoStartup(boolean autoStartup)

Configure whether the StompBrokerRelayMessageHandler should start automatically when the Spring ApplicationContext is refreshed.

The default setting is true.

setClientLoginback to summary
public StompBrokerRelayRegistration setClientLogin(String login)

Set the login to use when creating connections to the STOMP broker on behalf of connected clients.

By default this is set to "guest".

setClientPasscodeback to summary
public StompBrokerRelayRegistration setClientPasscode(String passcode)

Set the passcode to use when creating connections to the STOMP broker on behalf of connected clients.

By default this is set to "guest".

setRelayHostback to summary
public StompBrokerRelayRegistration setRelayHost(String relayHost)

Set the STOMP message broker host.

setRelayPortback to summary
public StompBrokerRelayRegistration setRelayPort(int relayPort)

Set the STOMP message broker port.

setSystemHeartbeatReceiveIntervalback to summary
public StompBrokerRelayRegistration setSystemHeartbeatReceiveInterval(long heartbeatReceiveInterval)

Set the maximum interval, in milliseconds, at which the "system" relay session expects, in the absence of any other data, to receive a heartbeat from the STOMP broker. A value of zero will configure the relay session to expect not to receive heartbeats from the broker.

The default value is 10000.

setSystemHeartbeatSendIntervalback to summary
public StompBrokerRelayRegistration setSystemHeartbeatSendInterval(long systemHeartbeatSendInterval)

Set the interval, in milliseconds, at which the "system" relay session will, in the absence of any other data being sent, send a heartbeat to the STOMP broker. A value of zero will prevent heartbeats from being sent to the broker.

The default value is 10000.

setSystemLoginback to summary
public StompBrokerRelayRegistration setSystemLogin(String login)

Set the login for the shared "system" connection used to send messages to the STOMP broker from within the application, i.e. messages not associated with a specific client session (e.g. REST/HTTP request handling method).

By default this is set to "guest".

setSystemPasscodeback to summary
public StompBrokerRelayRegistration setSystemPasscode(String passcode)

Set the passcode for the shared "system" connection used to send messages to the STOMP broker from within the application, i.e. messages not associated with a specific client session (e.g. REST/HTTP request handling method).

By default this is set to "guest".

setTaskSchedulerback to summary
public StompBrokerRelayRegistration setTaskScheduler(TaskScheduler taskScheduler)

Some STOMP clients (e.g. stomp-js) always send heartbeats at a fixed rate but others (Spring STOMP client) do so only when no other messages are sent. However messages with a non-broker destination prefix aren't forwarded and as a result the broker may deem the connection inactive.

When this TaskScheduler is set, it is used to reset a count of the number of messages sent from client to broker since the beginning of the current heartbeat period. This is then used to decide whether to send a heartbeat to the broker when ignoring a message with a non-broker destination prefix.

Since
5.3
setTcpClientback to summary
public StompBrokerRelayRegistration setTcpClient(TcpOperations<byte[]> tcpClient)

Configure a TCP client for managing TCP connections to the STOMP broker.

By default ReactorNettyTcpClient is used.

Note

when this property is used, any host or port specified are effectively ignored.

Since
4.3.15
setUserDestinationBroadcastback to summary
public StompBrokerRelayRegistration setUserDestinationBroadcast(String destination)

Set a destination to broadcast messages to user destinations that remain unresolved because the user appears not to be connected. In a multi-application server scenario this gives other application servers a chance to try.

By default this is not set.

Parameters
destination:String

the destination to broadcast unresolved messages to, e.g. "/topic/unresolved-user-destination"

setUserRegistryBroadcastback to summary
public StompBrokerRelayRegistration setUserRegistryBroadcast(String destination)

Set a destination to broadcast the content of the local user registry to and to listen for such broadcasts from other servers. In a multi-application server scenarios this allows each server's user registry to be aware of users connected to other servers.

By default this is not set.

Parameters
destination:String

the destination for broadcasting user registry details, e.g. "/topic/simp-user-registry".

setVirtualHostback to summary
public StompBrokerRelayRegistration setVirtualHost(String virtualHost)

Set the value of the "host" header to use in STOMP CONNECT frames. When this property is configured, a "host" header will be added to every STOMP frame sent to the STOMP broker. This may be useful for example in a cloud environment where the actual host to which the TCP connection is established is different from the host providing the cloud-based STOMP service.

By default this property is not set.