You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Lorenzo Bolzani <l....@gmail.com> on 2012/07/16 21:54:39 UTC

Best configuration for a producer/consumer scenario

Hi,
I need to implement this simple scenario

producer -> consumer


The producer runs once a day and generates thousands of messages to
process. A pool of consumers runs for the rest of the day processing the
messages. Processing a message takes about 2/6 seconds.

The first naive implementation was to have the producer send the messages,
asynchronously, straight to the  consumer. With this configuration the
consumer is flooded, I have rejectedExecutions from the consumer pool, the
consumer pool grows wild, etc.


So I think I should modify the configuration in this way


producer -> jms:provider -> jms:consumer -> consumer


In this way the producer should be able to fill the queue as he likes and
the consumer will dequeue the messages at a fixed rate based on the pool
size.

I still have to try this, but I think that this will not work. If the
jms:consumer sends the messages to the consumer asynchronously it will be
extremely fast to dequeue the messages and the consumer will be flooded
again.

Is it correct to configure the communication from jms:consumer to consumer
as synchronous to resolve this?

In this way the attribute "concurrentConsumers" should determine the rate
of message dequeuing.

Is this a good solution or I'm starting off on the wrong foot?


Thanks in advance, bye


Lorenzo