On Jan 24, 2008 12:01 PM, Kevin k <[EMAIL PROTECTED]> wrote: > > Thanks for you quick response. > > Just to understand your answer, > Does every consumer that has been configured work on one message at a time, > or does the dispatcher kick off a new consumer for every message it has?
A JMS consumer is a an application that is completely separate from the broker. It runs in a different JVM from the broker. The broker is the message mediator between one JVM running a producer and a different JVM running a consumer and it looks like this: (producer) --- sends message --> (broker) <--- consumes message --- (consumer) The broker does not kick off a consumer. A consumer connectds to a broker and registers itself with the broker to indicate that it wants to receive messages from a JMS destintation. The broker then simply dispatches messages to a registered consumer via the connection the consumer made to the broker when it registered itself. > So lets say I have 100 messages in a queue and a single consumer configured. > Would there be a single consumer that works on one message at a time, or > would the the dispatcher try to kick off 100 separate consumers. Again, the broker does not start up consumers. It simply dispatches messages to any registered consumers. One very common scenario with many messages stacked up in a queue is that message processing by a consumer can be very slow. (NOTE: Receiving a message and actually processing that message to send the ack are two different tasks.) If the broker dispatches messages to the consumer faster than the consumer can process and ack them, a slow consumer situation will be encountered. ActiveMQ provides some configuration options to handle this situation: http://activemq.apache.org/slow-consumer-handling.html > Then lets say I wanted to have 5 messages worked on at a time. > Would I need to configure 5 separate consumers, or would I do that through > the dispatcher throttling? Well it depends on what exactly you want to do. You could start up five consumers if you want and have the broker more or less load balance across them, but only if you're using a JMS queue. This is because the JMS spec guarantees once-and-only-once delivery of a message, i.e., not two consumers will be able to ack the same message from a queue. On the other hand, if you're using a JMS topic, every registered consumer to the topic is guaranteed by > One more question, is there any documentation on the dispatcher throttling? Well the info above about the slow consumer handling certainly applies. Also, today I blogged about an article written by Hiram, one of the architects of ActiveMQ that discusses the threading in ActiveMQ: http://bsnyderblog.blogspot.com/2008/01/understanding-threads-allocated-in.html Additionally, take a look at the following ActiveMQ documents: http://activemq.apache.org/dispatch-policies.html http://activemq.apache.org/consumer-dispatch-async.html http://activemq.apache.org/how-do-i-change-dispatch-policy.html Bruce -- perl -e 'print unpack("u30","D0G)[EMAIL PROTECTED]&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*" );' Apache ActiveMQ - http://activemq.org/ Apache Camel - http://activemq.org/camel/ Apache ServiceMix - http://servicemix.org/ Apache Geronimo - http://geronimo.apache.org/ Blog: http://bruceblog.org/
