@ -51,6 +52,9 @@ public class StompBrokerRelayRegistration extends AbstractBrokerRegistration {
@@ -51,6 +52,9 @@ public class StompBrokerRelayRegistration extends AbstractBrokerRegistration {
@Nullable
privateStringvirtualHost;
@Nullable
privateTcpOperations<byte[]>tcpClient;
privatebooleanautoStartup=true;
@Nullable
@ -166,6 +170,18 @@ public class StompBrokerRelayRegistration extends AbstractBrokerRegistration {
@@ -166,6 +170,18 @@ public class StompBrokerRelayRegistration extends AbstractBrokerRegistration {
@ -239,6 +255,9 @@ public class StompBrokerRelayRegistration extends AbstractBrokerRegistration {
@@ -239,6 +255,9 @@ public class StompBrokerRelayRegistration extends AbstractBrokerRegistration {
@ -340,6 +340,9 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
@@ -340,6 +340,9 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
@ -613,8 +616,8 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
@@ -613,8 +616,8 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
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
endpoint and establish the client identity.
need not set those headers; they will be ignored. As the <<websocket-stomp-authentication>>
section explains, instead WebSocket clients should rely on HTTP authentication to protect
the WebSocket endpoint and establish the client identity.
====
The STOMP broker relay also sends and receives heartbeats to and from the message
@ -1451,13 +1451,43 @@ and receiving heartbeats (10 seconds each by default). If connectivity to the br
@@ -1451,13 +1451,43 @@ 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) {