Eric
Eric

Reputation: 65

Deliver Exactly Once

Is there a way to configure 'exactly once' processing of a message delivered using a RabbitMQ exchange/queue? Basically we have a consuming application that consists of 2 nodes in a cluster, both of these nodes are going to subscribe to the same queue on Rabbit however only one of these two nodes should be processing a message at a given time. My first thought was that this would work right out of the box considering rabbit uses 'round robin' message delivery however we cannot guarantee that there will not be other consumers in the future. Is the best practice to create specific queue's for each consuming application and use the default round robin assignment feature?

Upvotes: 6

Views: 10567

Answers (1)

user11044402
user11044402

Reputation:

An additional consumer of the queue will be part of the round robin message consumption just as the existing consumers are. Each message routed to the quote will be delivered to exactly one consumer.

Creating an exclusive queue for every consuming application will lead to the problem of how to ensure the exactly once semantics. This would require RabbitMQ to route every message to exactly one of these queues. To make this happens, the exchange would have route in a round robin way. This is not possible in AMQP.

Use a single queue and consume messages from it using as many workers as you want. This will give you exactly once semantics.

Upvotes: 1

Related Questions