We have a springboot application which contains multiple JMS listeners reading message from different destinations. The application has a common logging framework which provides methods to log specific values taken from input message from each listener class and log the same in a file system as a single line per record.
We have found that the logs are getting mixed with values from both listeners when the message is received by both listeners at the same time. the log framework class is autowired in both listeners but there is an initialize of values/maps/objects at the start of every txn.
The JMS listener is connecting to IBM MQ.
It seems the JMS listeners are sharing the same thread hence, the values are shared. I tried to assign different connection factory, taskExecutors used synchronized keywords inside listener class, used concurrentMaps to store log values, but none of the method seems to be working.
The ask is how to assign different threads from start to individual listeners or any more inputs how to make the logging framework (methods) thread-safe.
Thanks