Session Disconnecting with reason SESSION_NOT_RELIABLE(4500) in sprinboot stomp websocket - spring

We are using Stomp Websocket with internal message broker in springboot service.
In case of multiple users, we are getting many disconnects with error code 4500 leading to issues.
How can we handle this error code so the connection doesn't disconnects.

Related

Playtika's OSS Feign Client: org.springframework.web.reactive.function.client.WebClientRequestException: Connection prematurely closed BEFORE response

The issue
I've stumbled upon the issue:
Error message: org.springframework.web.reactive.function.client.WebClientRequestException: Connection prematurely closed BEFORE response; nested exception is reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response
General info about the issue
It's a Spring Boot app (2.4.5) running on Reactive (WebFlux) stack.
The app also uses Playtika OSS reactive Feign Client (starter 3.0.3) for synchronious REST API communication.
Underlying web client is Netty.
There are no any special Feign or WebClient configs in the app.
All the other microservice parties are running on embedded Tomcat with default Spring Boot autoconfigurations.
All apps are running in Kubernetes cluster.
The error log observed from time to time (not every day).
Guesses
After some investigation, my best guess would be that some long-lived connections are being dropped from the pool on certain conditions. This causing the error log.
This thought is based on Instana that connects the error log to the span that spans accross a lot of subcalls.
Also no data losses/ other inconsistencies were noticed so far xD
Questions
Does Feign has a connection pool by default?
How to know if those are live or idle connections from the pool being closed?
How the connection pool can be configured or dropped to avoid long-running connections ?
Is it possible that Kubernetes can somehow close these connections?
What else can close connections?

Spring websocket/broker fail over

I have the following design:
Machine1
WebsocketApp
ActiveMQ broker
Machine2
WebsocketApp
ActiveMQ broker
Machine3
WebsocketApp
ActiveMQ broker
Machine4
WebsocketApp
ActiveMQ broker
The clients will use STOMP over WebSockets through an F5 load-balancer to connect to the ActiveMQ brokers. They can land on any machines based on the load factor.
For fail over scenarios how do we share the web socket sessions between ActiveMQ. Otherwise if the broker goes down all the sessions that it is holding will go down.
STOMP is a very simple protocol. It has no support for fail-over.
If the broker to which a STOMP client is connected goes down in your environment then that client's connection will go down and all the messages on that broker will be unavailable until the broker comes back up. The client will need to reconnect to another broker via the F5 URL.
STOMP connections are not like HTTP. They are stateful. Client "session" data is not shared among brokers. If a client's broker goes down then it cannot simply carry on as if nothing happened like is often possible for HTTP use-cases.

Spring JMS with IBM MQ connection refresh or invalidation

Current situation:
Spring boot application using com.ibm.mq:mq-jms-spring-boot-starter is receiving messages from IBM MQ and is working fine. Our IBM MQ server closes inactive connections after an hour and this throws exceptions at the client application (IBM MQ call failed with compcode '2' ('MQCC_FAILED') reason '2009' ('MQRC_CONNECTION_BROKEN')). The client recovers correctly by starting a new connection but we want to prevent these errors by invalidating connections so we frequently get a new connection.
To prevent these inactive connections we would like the client application to make a new connection every 10 minutes for example when listening for messages. How would we configure these connections timeouts?

Building realtime messaging app with websockets in spring boot

I want to build a messaging backend service (similar to whatsapp) using spring boot and websockets.
I have look online at the examples of spring boot websockets.
I see how I would send a message to the server from client 1 using the #MessageMapping annotation.
However assuming client 2 (recipient of the message) is also connected to the server with websockets how would I send a message to them.
I have seen the sendToUser annotation however it seems to me that that sends the message to client 1 (the sender of the message).
Is there a map of client ids to websocket sessions or something so that if I know the message should go to (client 2). I can gethis active websocket session and then send him the message?

Any websocket error codes simulator available to test java websocket client for different websocket errors that can come

I have a STOMP over websocket client server implementation. I want to test my java websocket client implemented using javax websocket on eclipse jetty for different websocket errors that can come. Is there a websocket simulator that can send different websocket error codes that I wish to test ?
My websocket server is implemented using spring websockets.

Resources