Monday, August 24, 2020

Maintain ordering in ActiveMQ with Multiple consumer - Exclusive consumer

 

Exclusive consumer - ActiveMQ Embedded

If you have multiple MessageConsumer consuming from same queue irrespective of same JVM or not. Then the order of processing of  queue object can not guarantee.
In order to maintain the order in which object inserted 'Exclusive consumer' needed.
The broker will pick a single MessageConsumer to get all the messages for a queue to ensure ordering. If that consumer fails, the broker will auto failover and choose another consumer

In order to make Exclusive consumer, we can make consumer is exclusive or not,  when defining queue name

public static final String data_queue = "data-queue?consumer.exclusive=true";

Labels: ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home