0
votes

I'm trying to setup a workflow where the Producer sends off a message to the broker, the broker sends the message to a consumer, and a consumer ACK's back to on the same queue/channel and that is picked up as "confirm" by the Producer.

I'm basing my info off of this: http://www.rabbitmq.com/blog/2011/02/10/introducing-publisher-confirms/

According to that document, it should wait for the consumer to send an ack or a nack. However, in my testing, it returns the ack immediately(as soon as it reaches the broker(RabbitMQ)).

The document says that will happen in three scenarios:

  • an un-routable mandatory or immediate message is confirmed right after the basic.return;

  • otherwise, a transient message is confirmed the moment it is enqueued; and,

  • a persistent message is confirmed when it is persisted to disk or when it is consumed on every queue.

I made sure to set my queue to durable and set the delivery mode to 2(persisent) when calling basicPublish. So it is a persisent message. I also made sure that is getting successfully routed to a queue.

Is this expected behavior? Or am doing something wrong to make it ACK immediately instead of waiting for the ack from the consumer?

1

1 Answers

2
votes

Publisher Confirms is not related to when the consumer acks the message.

A broker will send a "publisher confirm" when the message has been persisted.

The only way for a publisher to know if the consumer got the message is to implement some sort of RPC: http://www.rabbitmq.com/tutorials/tutorial-six-python.html

I wonder why do you need to know if the consumer received the message, since messaging is usually async, so by waiting for a receipt from the consumer, then you are turning your architecture in sync solution