Heartbeat in lieu of non-broker destination message

Closes gh-22822
This commit is contained in:
Rossen Stoyanchev
2020-10-19 13:06:17 +01:00
parent a4d0af802a
commit d18fbab7a8
7 changed files with 214 additions and 31 deletions

View File

@@ -2194,6 +2194,14 @@ and optionally customize the heartbeat intervals (10 seconds for write inactivit
which causes a heartbeat to be sent, and 10 seconds for read inactivity, which
closes the connection).
`WebSocketStompClient` sends a heartbeat only in case of inactivity, i.e. when no
other messages are sent. This can present a challenge when using an external broker
since messages with a non-broker destination represent activity but aren't actually
forwarded to the broker. In that case you can configure a `TaskScheduler`
when initializing the <<websocket-stomp-handle-broker-relay>> which ensures a
heartbeat is forwarded to the broker also when only messages with a non-broker
destination are sent.
NOTE: When you use `WebSocketStompClient` for performance tests to simulate thousands
of clients from the same machine, consider turning off heartbeats, since each
connection schedules its own heartbeat tasks and that is not optimized for