spring-projects / spring-ws

Spring Web Services
https://spring.io/projects/spring-ws
Apache License 2.0
321 stars 312 forks source link

StompBrokerRelay keeps connecting and disconnecting #1364

Closed tobiascapin closed 1 year ago

tobiascapin commented 1 year ago

I'm experiencing an error with RabbitMQ as external StompBroker with Spring WS version 6.0.9 and Windows 11 environment. The RabbitMQ and WebSocketMessageBrokerConfigurer are correctly configured (stomp plugin enabled and tests, rabbitmw uses standard ports and "guest" authentication ). But the JS client received this error at CONNECTION message:

ERROR
message:Broker not available.
content-length:0

Checking on Spring logs, I found that the "system" connection to RabbitMQ is continuosly opened and closed.

2023-05-31 12:25:54.836 DEBUG 24772 --- [nt-scheduler-11] o.s.m.s.s.StompBrokerRelayMessageHandler : TCP connection opened in session=_system_
2023-05-31 12:25:54.837 TRACE 24772 --- [nt-scheduler-11] o.s.messaging.simp.stomp.StompEncoder    : Encoding STOMP CONNECT, headers={accept-version=[1.1,1.2], login=[guest], passcode=[PROTECTED], heart-beat=[10000,10000]}
2023-05-31 12:25:54.847 DEBUG 24772 --- [nt-scheduler-12] o.s.m.s.s.StompBrokerRelayMessageHandler : TCP connection to broker closed in session _system_
2023-05-31 12:25:54.847 DEBUG 24772 --- [nt-scheduler-12] o.s.m.s.s.StompBrokerRelayMessageHandler : Cleaning up connection state for session _system_
2023-05-31 12:25:55.476 DEBUG 24772 --- [ent-scheduler-2] o.s.m.s.s.StompBrokerRelayMessageHandler : TCP connection opened in session=_system_
2023-05-31 12:25:55.476 TRACE 24772 --- [ent-scheduler-2] o.s.messaging.simp.stomp.StompEncoder    : Encoding STOMP CONNECT, headers={accept-version=[1.1,1.2], login=[guest], passcode=[PROTECTED], heart-beat=[10000,10000]}
2023-05-31 12:25:55.481 DEBUG 24772 --- [ent-scheduler-3] o.s.m.s.s.StompBrokerRelayMessageHandler : TCP connection to broker closed in session _system_
2023-05-31 12:25:55.481 DEBUG 24772 --- [ent-scheduler-3] o.s.m.s.s.StompBrokerRelayMessageHandler : Cleaning up connection state for session _system_
2023-05-31 12:25:59.858 DEBUG 24772 --- [ent-scheduler-5] o.s.m.s.s.StompBrokerRelayMessageHandler : TCP connection opened in session=_system_
2023-05-31 12:25:59.859 TRACE 24772 --- [ent-scheduler-5] o.s.messaging.simp.stomp.StompEncoder    : Encoding STOMP CONNECT, headers={accept-version=[1.1,1.2], login=[guest], passcode=[PROTECTED], heart-beat=[10000,10000]}
2023-05-31 12:25:59.862 DEBUG 24772 --- [ent-scheduler-6] o.s.m.s.s.StompBrokerRelayMessageHandler : TCP connection to broker closed in session _system_
2023-05-31 12:25:59.862 DEBUG 24772 --- [ent-scheduler-6] o.s.m.s.s.StompBrokerRelayMessageHandler : Cleaning up connection state for session _system_
2023-05-31 12:26:00.497 DEBUG 24772 --- [ent-scheduler-8] o.s.m.s.s.StompBrokerRelayMessageHandler : TCP connection opened in session=_system_
2023-05-31 12:26:00.498 TRACE 24772 --- [ent-scheduler-8] o.s.messaging.simp.stomp.StompEncoder    : Encoding STOMP CONNECT, headers={accept-version=[1.1,1.2], login=[guest], passcode=[PROTECTED], heart-beat=[10000,10000]}
2023-05-31 12:26:00.502 DEBUG 24772 --- [ent-scheduler-9] o.s.m.s.s.StompBrokerRelayMessageHandler : TCP connection to broker closed in session _system_
2023-05-31 12:26:00.502 DEBUG 24772 --- [ent-scheduler-9] o.s.m.s.s.StompBrokerRelayMessageHandler : Cleaning up connection state for session _system_
2023-05-31 12:26:04.869 DEBUG 24772 --- [nt-scheduler-11] o.s.m.s.s.StompBrokerRelayMessageHandler : TCP connection opened in session=_system_
2023-05-31 12:26:04.870 TRACE 24772 --- [nt-scheduler-11] o.s.messaging.simp.stomp.StompEncoder    : Encoding STOMP CONNECT, headers={accept-version=[1.1,1.2], login=[guest], passcode=[PROTECTED], heart-beat=[10000,10000]}
2023-05-31 12:26:04.878 DEBUG 24772 --- [nt-scheduler-12] o.s.m.s.s.StompBrokerRelayMessageHandler : TCP connection to broker closed in session _system_
2023-05-31 12:26:04.878 DEBUG 24772 --- [nt-scheduler-12] o.s.m.s.s.StompBrokerRelayMessageHandler : Cleaning up connection state for session _system_
2023-05-31 12:26:05.508 DEBUG 24772 --- [ent-scheduler-2] o.s.m.s.s.StompBrokerRelayMessageHandler : TCP connection opened in session=_system_
2023-05-31 12:26:05.508 TRACE 24772 --- [ent-scheduler-2] o.s.messaging.simp.stomp.StompEncoder    : Encoding STOMP CONNECT, headers={accept-version=[1.1,1.2], login=[guest], passcode=[PROTECTED], heart-beat=[10000,10000]}
2023-05-31 12:26:05.512 DEBUG 24772 --- [ent-scheduler-3] o.s.m.s.s.StompBrokerRelayMessageHandler : TCP connection to broker closed in session _system_
2023-05-31 12:26:05.512 DEBUG 24772 --- [ent-scheduler-3] o.s.m.s.s.StompBrokerRelayMessageHandler : Cleaning up connection state for session _system_
2023-05-31 12:26:09.891 DEBUG 24772 --- [ent-scheduler-5] o.s.m.s.s.StompBrokerRelayMessageHandler : TCP connection opened in session=_system_
2023-05-31 12:26:09.892 TRACE 24772 --- [ent-scheduler-5] o.s.messaging.simp.stomp.StompEncoder    : Encoding STOMP CONNECT, headers={accept-version=[1.1,1.2], login=[guest], passcode=[PROTECTED], heart-beat=[10000,10000]}
2023-05-31 12:26:09.896 DEBUG 24772 --- [ent-scheduler-6] o.s.m.s.s.StompBrokerRelayMessageHandler : TCP connection to broker closed in session _system_
2023-05-31 12:26:09.896 DEBUG 24772 --- [ent-scheduler-6] o.s.m.s.s.StompBrokerRelayMessageHandler : Cleaning up connection state for session _system_
2023-05-31 12:26:10.515 DEBUG 24772 --- [ent-scheduler-8] o.s.m.s.s.StompBrokerRelayMessageHandler : TCP connection opened in session=_system_
2023-05-31 12:26:10.516 TRACE 24772 --- [ent-scheduler-8] o.s.messaging.simp.stomp.StompEncoder    : Encoding STOMP CONNECT, headers={accept-version=[1.1,1.2], login=[guest], passcode=[PROTECTED], heart-beat=[10000,10000]}
2023-05-31 12:26:10.519 DEBUG 24772 --- [ent-scheduler-9] o.s.m.s.s.StompBrokerRelayMessageHandler : TCP connection to broker closed in session _system_
2023-05-31 12:26:10.520 DEBUG 24772 --- [ent-scheduler-9] o.s.m.s.s.StompBrokerRelayMessageHandler : Cleaning up connection state for session _system_

I tought I was somehow linked to my app, then I tried this demo app https://github.com/djselzlein/spring-websockets-rabbitmq-demo with different Spring version, but the issue is exactly the same.

tobiascapin commented 1 year ago

The issue seems related to RabbitMQ Windows version because I'm not experincing this issue using dockerized version of rabbitmq.