-
1. Re: Jms consumers concurrency
jbertram Jul 8, 2015 4:55 PM (in response to lauradp)JMS sessions are not thread-safe and should never be shared among concurrent threads. Every consumer should get its own session. However, all sessions can share the same connection.
-
2. Re: Jms consumers concurrency
lauradp Jul 9, 2015 4:21 AM (in response to lauradp)I tried creating a new session for each consumer and no message is consumed at all.
In Jms-metrics page I can see 10 consumers listening on the queue and 1 message in the queue (o in delivery).
How can I get rid of this block?
Laura
-
3. Re: Jms consumers concurrency
jbertram Jul 9, 2015 9:27 AM (in response to lauradp)I assume the problem is due to a bug in your application so I can't help you more until you provide me with more details about what your application is doing specifically.
-
4. Re: Jms consumers concurrency
lauradp Jul 9, 2015 2:32 PM (in response to jbertram)You were right, I was not starting the connection.
Can I use a consumer for each queue (I.e. all consumers listening on the same queue share the same session)?
Laura
-
5. Re: Jms consumers concurrency
zzz_public Jul 21, 2015 8:45 AM (in response to lauradp)I think there may be another solution similar to network connection management.
Don't issue business login in an onMessage method but just receive a message and put it to some BlockingQueue. Then organaze a thread pool behind that queue. Workers in the thread pool could do business logic.
-
6. Re: Jms consumers concurrency
jbertram Jul 22, 2015 6:48 AM (in response to lauradp)I would steer clear of sharing sessions altogether.