Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RabbitMQ - Find out on publisher side that a message has been acknowledged by the consumer(s)

Tags:

rabbitmq

amqp

I am using RabbitMQ as a MQ broker. Is it possible to get a notification that a certain message has been acknowledged by all queues? That is, if it was sent to 5 queues, we get a notification after the acknowledgment of the last/5th consumer.

I know you can introduce reply-to queues, but that's not what I am looking for. I don't want to force the consumer to send an acknowledgment message to some queue after acknowledgment.

Is it also possible to continue this follow-up after a broker and/or publisher restart?

like image 512
TheMQJuggler Avatar asked Jun 28 '17 13:06

TheMQJuggler


1 Answers

No, it is not possible as you state it.

You cannot, from the publisher side, know whether a message has been ACK'd at the consumer side, and in most patterns it's not really something you'd want anyway.

You can, however, use Publisher Confirms. These would inform the publisher that the message has been routed to all the bound queues.

There are several mechanisms for data safety on both the publisher and consumer side. You would normally trust that the broker does not miss messages in between, the same way you trust that a database will hold the records over time.

If nevertheless your workflow requires that your publisher side is informed about the completion of a complex distributed task, and you really can't get away with fire and forget, then you will need to implement that response yourself, normally by means of an additional message.

like image 69
istepaniuk Avatar answered Jan 04 '23 08:01

istepaniuk