1

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
  • 445
  • 1
  • 8
  • 18

1 Answers1

2

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
  • 8,993
  • 2
  • 20
  • 33
  • Thanks Luke, does AMQP take into account the scenario of multiple consumers with replica sets: 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 Updated the OP with the "diagram" – Steve Nov 15 '19 at 00:41
  • @Steve what exactly do you mean by `channel` in "1 message is sent to RabbitMQ Channel 1:". Channels are transport layers, you send messages to either exchanges or queues. – zerkms Nov 15 '19 at 00:48
  • @zerkms, as you can tell I'm not a Rabbit MQ person. I've used ActiveMQ classic with topics and queues. Rabbit MQ/AMQP endpoint is from a 3rd party vendor. If they use an exchange will that send the message to all consumers even the ones which are part of a replica set? – Steve Nov 15 '19 at 04:49
  • @Steve it depends on how they are configured, it might be delivered to all, or just one. – zerkms Nov 15 '19 at 07:39
  • @zerkms - sorry are you talking about the consumers or the exchange? – Steve Nov 15 '19 at 22:54
  • @Steve https://www.rabbitmq.com/tutorials/tutorial-two-java.html – zerkms Nov 16 '19 at 06:03