AMQP (RabbitMQ) Pub/Sub with clustered Client

11/14/2019

We are going to be developing a client which subscribes to an AMQP channel, but the client is going to be clustered (in Kubernetes) and we want only one of the clustered client to process the subscribed message.

For example, if we have a replica set of 3, we only want one to get the message, not all 3.

In JMS 2.0 this is possible using the shared consumers: https://www.oracle.com/technical-resources/articles/java/jms2messaging.html

1 message is sent to RabbitMQ Channel 1:

Consumer 1 (with 3 replicas) <----- RabbitMQ Channel 1
Consumer 2 (with 3 replicas) <----- RabbitMQ Channel 1

Only 2 messages would be processed 

Is something similar possible with AMQP? The client will be developed either in C# or MuleSoft.

Cheers, Steve

-- Steve
amqp
kubernetes
messaging
rabbitmq

1 Answer

11/14/2019

AMQP is designed for this. If you have three clients consuming from the same queue, RabbitMQ will round-robin delivery of messages to them. You may also be interested in the Single Active Consumer feature.


NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.

-- Luke Bakken
Source: StackOverflow