git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using ActiveMQ with more than one consumer instance


The behavior you want is the default behavior for a queue, so if you're
seeing the behavior you describe, it probably means you're doing something
wrong with the code that's acknowledging the message. (That, or you're
using a topic, not a queue.) Can you post the code that acknowledges the
message?

Alternatively, can you use AUTO_ACK mode instead of CLIENT_ACK mode, to
eliminate any errors relating to your acknowledgement code?

Tim

On Sat, Oct 13, 2018, 1:33 PM Moshe Recanati <
moshe.recanati@xxxxxxxxxxxxxxxxx> wrote:

> Hi,
> In our architecture we've 2 or more containers for each application for
> high availiability puproses.
> We're using activeMQ and I would like to implement the following behavior.
>
> 1. Pushing to a message to queue.
> 2. This message will be consumed only by *one *container (the first one
> that will read it).
> 2. Once message processed successfully the consumer will update this
> message can be acknowledged and neglected
> 3. I tried using transaction with commit and using CLIENT_ACKNOWLEDGE
> however
> in both cases both consumers got the message and processed it.
>
> I want only one consumer to process each message based on availability.
>
> Please share the way to implement it.
>
> Thank you
> Moshe
>