activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Terrk K <>
Subject transacted sessions in multi-threaded client
Date Wed, 10 Oct 2007 22:10:30 GMT

In a point-to-point queue I want to use transacted sessions to ensure
messages are processed completely before being removed from the queue. The
client is to be multi threaded to process messages in parallel.

I decided each thread would need it's own Session object (for transacting)
so that when the work on each message is successfully completed the session
can be commited. Session objects would be pooled and retrieved when the next
message is ready to be received.

The documentation states that, "ActiveMQ is a high performance message bus
that streams messages to consumers as fast as possible so that the consumer
always has a buffer of messages, in RAM, ready to process - rather than have
them explicitly pull messages from the server which adds significant latency
per message".

The problem is that messages will not be evenly distributed amoungst
Sessions, with the likeihood that a single session will be flooded with all
the messages making it impossible to distribute the work amoungst multiple

The logical next step would be to set the prefetch limit to one and have a
pull-one-message-at-a-time dispatch policy  (as described
Apparently, this is advised against as it's very SLOW
( I expect
millions of messages in my queue, each one can be processed in a matter of

The problem of multi threading and transacted sessions must be fairly common
- can anyone suggest other options?

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

View raw message