5

Is there any way in RabbitMQ to have multiple consumers get the same message from the same queue?

I need to send the same message to anyone who's listening but also ensure that someone deals with it. Basically, I need the fanout functionality of an exchange combined with the basic.ack functionality of a queue. Is there any way to accomplish this in a scalable way?

pinepain
  • 12,453
  • 3
  • 60
  • 65
wolverdude
  • 1,583
  • 1
  • 13
  • 20
  • whats wrong with using a fanout exchange? – robthewolf Oct 16 '13 at 06:33
  • I want one copy of the message to be persistent until it is acked. I don't want it sitting in multiple queues and potentially persisting beyond the first ack. – wolverdude Nov 11 '13 at 08:51
  • Ok so have one queue and multiple consumers as Abram says. Whey do all consumers have to see the message. – robthewolf Nov 11 '13 at 14:06
  • Synchronizing connections over a lossy (cell) network. Messages won't be sent if a client disconnects, but all connected clients get the same message. Honestly, this probably isn't the best architecture for implementing that anyway, which is why we've moved on. – wolverdude Nov 12 '13 at 16:11

1 Answers1

1

If you are trying to ensure that the message is properly processed, acknowledgement already provides this capability. If your consumer is unable to process the message and does not provide an ack it will be requeued and processed again by the next available consumer. Implementing multiple competing consumers on the same queue will give you round-robin delivery, allowing the other consumers a chance for success.

How scalable this will be depends on how long it takes to process each message compared to the incoming rate, queue durability, prefetch and how many competing consumers you have on the queue.

Abram Simon
  • 3,239
  • 21
  • 17
  • 1
    This does not work because if it is acknowledged by one consumer, it will never make it on to the other consumers that it may also pertain to. – wolverdude Oct 21 '13 at 05:02