'EMS : The Session was closed due to an unrecoverable error

I'm using SAP event mesh(EMS) for communication between events and sap JMS library(com.sap.cloud.servicesdk.xbem) for listening to messages from queue. But recently I have encountered exception while doing any operation and the exception is

javax.jms.IllegalStateException : The Session was closed due to an unrecoverable error

One example is while calling session.createQueue(queueName). After 1-2 days of inactivity the system goes to idle state and our application is no more able to listen to the EMS queues and because of that the data remain in the queue. It started working as expected after a fresh start. I did some analysis on the issue and found this workaround to set spring.jms.servicebus.idle-timeout property. But it usually decreases the usability of the JMS starter. So, Can anyone please suggest some other solution to resolve this error?



Solution 1:[1]

I have tried upgrading my library and then added some reconnection logic in case of any exceptions as mentioned in the link and it is working fine now.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 NEHA