OK, so you're looking for competing consumers, which queues give you by
default.  The caveat to that statement is that if you have a large prefetch
buffer (e.g. the default value of 1000) and one consumer connects before
the other one and there are messages waiting on the queue, up to the
prefetch size will be immediately dispatched to that first consumer, which
might leave none for the next consumer (which means they don't actually
compete in that scenario).

I see that you've tried to set the prefetch buffer size to 1, which is the
right approach to dealing with the problem, but have you confirmed that
it's actually having the desired effect?  You should be able to look at the
consumers via the web console or JConsole and see what prefetch size is
being used; if it's not the value you're trying to set it to, you know
you've got something not working right there.

Tim

On Wed, Jul 20, 2016 at 10:38 PM, etiennet123 <etie...@lambdasales.com>
wrote:

> Hi Tim
>
> Thanks for the response.
>
> Perhaps round robin is not the best way to describe it.
>
> What I am trying to do is this. I have a producer that sends XML messages
> to
> the queue.
> This happens quite fast. I then have to consume theses messages, process
> these messages
> and send the result to a database. This takes a while like perhaps half a
> second.
> I want to have multiple consumers taking messages from the queue and
> processing them.
>
> In other words when it is finished processing the message it must fetch the
> next one.
>
> What I am experiencing at the moment is that both consumers start up fine.
> If I look on the
> ActiveMQ queues page it shows two consumers as well.
>
> The problem is that which ever one I start first consumes and the second
> one
> blocks until
> I stop this first consumer.
>
> Etienne
>
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Problem-Consuming-from-queue-with-more-than-one-consumer-tp4714196p4714212.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Reply via email to