[rabbitmq-discuss] reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag

Michael Klishin mklishin at gopivotal.com
Tue Jul 16 13:00:50 BST 2013


cheenu:

> Yes, my question is about error recovery in general.
> Yes, I open another channel, and understand Delivery is only valid in
> context of Channel that it was obtained from.

This is application-dependent.

The following strategy is supported by
at least two [Ruby] clients to recover from network failures. It's not perfect
but works surprisingly well in practice for most cases:

 * Reconnect
 * "reopen" channels (either replace channel references to a new channel or make existing instances get a new id)
 * redeclare exchanges
 * redeclare queues, keeping track of which queues are server-named
 * rebind
 * redeclare consumers

This, however, will generally be easier if your client uses objects for queues, exchanges 
and consumers. Not all of them do.

Recovering from channel-specific errors for consumers is less involved:

 * reopen the channel
 * redeclare queues [if needed]
 * rebind
 * redeclare consumers

since delivery tag values become invalid ("unknown") on the new channel, you need to avoid
acking earlier deliveries. With manual acknowledgements, those messages will be requeued
so you'll get them delivered again (but this may be to a different consumer).

> Am wondering, if there is anyway to "re-connect" delivery to a new channel,
> or in general make a reconnect behind the scenes.

New channels have delivery tag counter set to 0, so no.

I hope that there will be a way to make ack/delivery tag tracking automatic in Ruby clients
first, then if it works well, some kind of solution can be introduced to more clients over time.

I'd certainly agree that error handling and recovery can be tricky to get right with the protocol.
Fortunately, in many cases client libraries can be improved to take care of most steps.
--
MK

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130716/65f53169/attachment.pgp>


More information about the rabbitmq-discuss mailing list