@ -47,6 +49,8 @@ public class StompBrokerRelayRegistration extends AbstractBrokerRegistration {
@@ -47,6 +49,8 @@ public class StompBrokerRelayRegistration extends AbstractBrokerRegistration {
privateStringvirtualHost;
privateTcpOperations<byte[]>tcpClient;
privatebooleanautoStartup=true;
privateStringuserDestinationBroadcast;
@ -160,6 +164,18 @@ public class StompBrokerRelayRegistration extends AbstractBrokerRegistration {
@@ -160,6 +164,18 @@ public class StompBrokerRelayRegistration extends AbstractBrokerRegistration {
@ -231,6 +247,9 @@ public class StompBrokerRelayRegistration extends AbstractBrokerRegistration {
@@ -231,6 +247,9 @@ public class StompBrokerRelayRegistration extends AbstractBrokerRegistration {
@ -334,6 +334,9 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
@@ -334,6 +334,9 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
@ -100,13 +101,28 @@ public class Reactor2TcpClient<P> implements TcpOperations<P> {
@@ -100,13 +101,28 @@ public class Reactor2TcpClient<P> implements TcpOperations<P> {
@ -118,7 +134,7 @@ public class Reactor2TcpClient<P> implements TcpOperations<P> {
@@ -118,7 +134,7 @@ public class Reactor2TcpClient<P> implements TcpOperations<P> {
returnspec
.env(environment)
.codec(codec)
.connect(host,port)
.connect(addressSupplier)
.options(createClientSocketOptions());
}
@ -133,10 +149,13 @@ public class Reactor2TcpClient<P> implements TcpOperations<P> {
@@ -133,10 +149,13 @@ public class Reactor2TcpClient<P> implements TcpOperations<P> {
Assert.notNull(tcpClientSpecFactory,"'tcpClientClientFactory' must not be null");
@ -295,6 +314,21 @@ public class Reactor2TcpClient<P> implements TcpOperations<P> {
@@ -295,6 +314,21 @@ public class Reactor2TcpClient<P> implements TcpOperations<P> {
The STOMP broker relay always sets the `login` and `passcode` headers on every `CONNECT`
frame that it forwards to the broker on behalf of clients. Therefore WebSocket clients
need not set those headers; they will be ignored. As the following section explains,
instead WebSocket clients should rely on HTTP authentication to protect the WebSocket
need not set those headers; they will be ignored. As the <<websocket-stomp-authentication>>
explains, instead WebSocket clients should rely on HTTP authentication to protect the WebSocket
endpoint and establish the client identity.
====
@ -1626,13 +1626,47 @@ and receiving heartbeats (10 seconds each by default). If connectivity to the br
@@ -1626,13 +1626,47 @@ and receiving heartbeats (10 seconds each by default). If connectivity to the br
is lost, the broker relay will continue to try to reconnect, every 5 seconds,
until it succeeds.
[NOTE]
====
A Spring bean can implement `ApplicationListener<BrokerAvailabilityEvent>` in order
Any Spring bean can implement `ApplicationListener<BrokerAvailabilityEvent>` in order
to receive notifications when the "system" connection to the broker is lost and
re-established. For example a Stock Quote service broadcasting stock quotes can
stop trying to send messages when there is no active "system" connection.
====
By default, the STOMP broker relay always connects, and reconnects as needed if
connectivity is lost, to the same host and port. If you wish to supply multiple addresses,
on each attempt to connect, you can configure a supplier of addresses, instead of a
fixed host and port. For example:
[source,java,indent=0]
[subs="verbatim,quotes"]
----
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {
// ...
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {