@@ -37997,7 +37997,7 @@ it acts as a "relay" forwarding messages in both directions.
37997
37997
37998
37998
[NOTE]
37999
37999
====
38000
- Please add a dependency on `org.projectreactor:reactor-tcp ` for TCP connection management.
38000
+ Please add a dependency on `org.projectreactor:reactor-net ` for TCP connection management.
38001
38001
====
38002
38002
38003
38003
Furthermore, application components (e.g. HTTP request handling methods,
@@ -38124,6 +38124,49 @@ for purging inactive destinations.
38124
38124
38125
38125
38126
38126
38127
+ [[websocket-stomp-appplication-context-events]]
38128
+ ==== ApplicationContext Events
38129
+
38130
+ The STOMP messaging support publishes the `ApplicationContext` events listed below.
38131
+ To subscribe to receive one or more of these events a Spring managed component can
38132
+ implement Spring's `ApplicationListener` interface. The events are:
38133
+
38134
+ * `BrokerAvailabilityEvent` -- indicates when the broker becomes available/unavailable.
38135
+ While the "simple" broker becomes available immediately on startup and remains so while
38136
+ the application is running, the STOMP "broker relay" may lose its connection
38137
+ to the full featured broker for example if the broker is restarted. The broker relay
38138
+ has reconnect logic and will re-establish the "system" connection to the broker
38139
+ when it comes back, hence this event is published whenever the state changes from connected
38140
+ to disconnected and vice versa. Components using the `SimpMessagingTemplate` should
38141
+ subscribe to this event and avoid sending messages at times when the broker is not
38142
+ available. In any case they should be prepared to handle `MessageDeliveryException`
38143
+ when sending a message.
38144
+ * `SessionConnectEvent` -- published when a new STOMP CONNECT is received
38145
+ indicating the start of a new client session. The event contains the message representing the
38146
+ connect including the session id, user information (if any), and any custom headers the client
38147
+ may have sent. This is useful for tracking client sessions. Components subscribed
38148
+ to this event can wrap the contained message using `SimpMessageHeaderAccessor` or
38149
+ `StompMessageHeaderAccessor`.
38150
+ * `SessionConnectedEvent` -- published shortly after a `SessionConnectEvent` when the
38151
+ broker has sent a STOMP CONNECTED frame in response to the CONNECT. At this point the
38152
+ STOMP session can be considered fully established.
38153
+ * `SessionDisconnectEvent` -- published when a STOMP session ends. The DISCONNECT may
38154
+ have been sent from the client or it may also be automatically generated when the
38155
+ WebSocket session is closed. In some cases this event may be published more than once
38156
+ per session. Components should be idempotent to multiple disconnect events.
38157
+
38158
+ [NOTE]
38159
+ ====
38160
+ When using a full-featured broker, the STOMP "broker relay" automatically reconnects the
38161
+ "system" connection should the broker become temporarily unavailable. Client connections
38162
+ however are not automatically reconnected. Assuming heartbeats are enabled, the client
38163
+ will typically notice the broker is not responding within 10 seconds. Clients need to
38164
+ implement their own reconnect logic.
38165
+ ====
38166
+
38167
+
38168
+
38169
+
38127
38170
[[websocket-stomp-configuration-performance]]
38128
38171
==== Configuration and Performance
38129
38172
0 commit comments