I’m experiencing a connection issue with WebSocket STOMP in Spring Boot using ActiveMQ Artemis. Despite proper heartbeat configurations, the broker closes the connection with the following error: AMQ229014: Did not receive data from /192.0.2.1:46748 within the 20000ms connection TTL.
Setup - Frontend: SockJS and Stomp.js, showing regular ping/pong exchanges in the browser console. - Backend: Spring Boot using StompBrokerRelayMessageHandler with custom ReactorNettyTcpClient for broker connections. Relevant configuration:
public void configureMessageBroker(MessageBrokerRegistry config) {
int sendInterval = 10000; // Send interval in milliseconds
int receiveInterval = (int) (sendInterval * heartBeatReceiveScale);
config.setApplicationDestinationPrefixes("/app");
config.enableStompBrokerRelay("/topic", "/queue")
.setUserDestinationBroadcast("/topic/random")
.setUserRegistryBroadcast("/topic/simp-user-registry")
.setTcpClient(createTcpClient())
.setSystemLogin(username)
.setSystemPasscode(password)
.setClientLogin(username)
.setClientPasscode(password)
.setSystemHeartbeatSendInterval(sendInterval) // Set heartbeat send interval
.setSystemHeartbeatReceiveInterval(receiveInterval);
}
Logs confirm a CONNECTED frame with heart-beat=[10000, 10000].
Observations - Frontend pings/pongs appear consistent. - Backend logs indicate heartbeats are sent and received. - Connection closes after the TTL timeout (20 seconds).
Questions - How can I verify heartbeats are properly received by the broker? - Are additional Spring Boot or Artemis configurations required to prevent disconnections?
Steps to Reproduce - Configure WebSocket STOMP with a broker using the above setup. - Send/receive heartbeats with the specified intervals. - Observe connection closure in logs despite consistent heartbeats.
Additional Context
Backend logs:
DEBUG StompBrokerRelayMessageHandler : Received CONNECTED heart-beat=[10000, 10000] session=itwv0lto DEBUG StompBrokerRelayMessageHandler : Forwarding SEND /topic/simp-user-registry session=_system_
Comment From: wilkinsona
Duplicates https://github.com/spring-projects/spring-framework/issues/34009. @abhishek0499 please respect the maintainers' time by not opening the same issue in multiple repositories.