activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jainmanglesh <>
Subject Re: consumer too slow to process messages
Date Fri, 01 Feb 2013 09:17:43 GMT
Hi Christian,
Thank you very much for your reply.

Actually I am creating N number of threads with N number of queues so each
thread would be executing messages from separate queue. As you can see from
the code I am creating threads in a loop (for N times) and adding those
threads in threads variable (which is list of thread, from the code: 
threads.add). I haev got run method for the thread which consumes the
messages. I have listeners which would execute these threads and hence run
the "run" method logic to consumer messages (the queue would be different
for each thread, so thread1 would be on queue1 and so on.... as you can see
from the code I am passing queueName as variable).

Regarding transaction, I am using XA transaction. I get a transaction (from
the code you can see), consumes the message and then commit. I am using
XAPooledConnectionFactory (which provide XA connection which are
automatically enlisted in current running transaction). I am creating
transactional session (passing true in the code) hoping that the created
session would be part of the initiated transaction. so once I commit
transaction, the transaction within the session would also get committed and
vice-versa if rollbacked (in which case I am hoping that activemq would not
remove the unconsumed messages).

I am not sure if this helps in getting issue or confuses further.

NOTE: I can use single connection and create more than one
sessions/consumers, however I read somewhere that there should be 1:1
mapping between session and connection, Is that right? if not then probably
I would not create connection atleast (and would have only one connection).

any thought? 

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message