Redelivered Flag

196 views
Skip to first unread message

Chuck Pence

unread,
Mar 30, 2016, 1:41:31 PM3/30/16
to rabbitmq-users
Reading through the RabbitMQ reliability documentation it states the following for producers...

When using confirms, producers recovering from a channel or connection failure should retransmit any messages for which an acknowledgement has not been received from the broker. There is a possibility of message duplication here, because the broker might have sent a confirmation that never reached the producer (due to network failures, etc). Therefore consumer applications will need to perform deduplication or handle incoming messages in an idempotent manner.

 than it goes on to talk about consumers stating that...

If a message is delivered to a consumer and then requeued (because it was not acknowledged before the consumer connection dropped, for example) then RabbitMQ will set the redelivered flag on it when it is delivered again (whether to the same consumer or a different one). This is a hint that a consumer may have seen this message before (although that's not guaranteed, the message may have made it out of the broker but not into a consumer before the connection dropped). Conversely if the redelivered flag is not set then it is guaranteed that the message has not been seen before. Therefore if a consumer finds it more expensive to deduplicate messages or process them in an idempotent manner, it can do this only for messages with the redelivered flag set.

 For a publisher that retransmits a message during recovery, is there a way to explicitly set or something that must be done to get the broker to set the redelivered flag.  I'm using a java client and there is a constructor for com.rabbitmq.client.Envelope that would allow me to explicitly create the envelope and set the flag, but I've found no way to use it as a publisher.

If not, consumers that are not idempotent need to run every message through dedup logic/process not just those with the redelivered flag set.  Am I missing something?




Michael Klishin

unread,
Mar 30, 2016, 3:49:17 PM3/30/16
to rabbitm...@googlegroups.com, Chuck Pence
 On 30 March 2016 at 20:41:34, Chuck Pence (chuck...@gmail.com) wrote:
> For a publisher that retransmits a message during recovery,
> is there a way to explicitly set or something that must be done
> to get the broker to set the redelivered flag. I'm using a java
> client and there is a constructor for com.rabbitmq.client.Envelope
> that would allow me to explicitly create the envelope and set
> the flag, but I've found no way to use it as a publisher.
>
> If not, consumers that are not idempotent need to run every message
> through dedup logic/process not just those with the redelivered
> flag set. Am I missing something?

That flag is never set by publishers, only RabbitMQ. Publishers are free to add any additional headers
they need.
--
MK

Staff Software Engineer, Pivotal/RabbitMQ


Reply all
Reply to author
Forward
0 new messages