Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ack only successful messages and expose ways to control nacks for users that want them #10

Merged
merged 6 commits into from
Mar 11, 2021

Conversation

atheriel
Copy link
Owner

Follows discussion in #2.

Changes:

  • Consumers created with amqp_consume() will now acknowledge messages only after the callback has run. Moreover, when a callback fails the message in question will be nacked instead. The new requeue_on_error parameter controls whether messages should be redelivered when callbacks error; by default it is FALSE, in line with current behaviour.

  • For complete control over when and how messages are nacked, one can use the new amqp_nack() function, which works like stop() inside a message handler. This allows for complex acknowledgement behaviour for a consumer, which might e.g. be used in combination with a dead letter exchange.

Includes tests and documentation updates.

The existing behaviour is basically the same as always having
no_ack=TRUE, in that messages are unequivocally acknowledged. However,
it is sometimes desirable to distinguish processing which fails from
that which succeeds, so callbacks which throw an error will now nack
messages instead -- without requeing them.

Since nack without requeue is only *semantically* (not operationally)
different than acknowledgment, existing workflows are unlikely to be
affected.

Documentation has been updated to reflect this behaviour.

Part of #2.
This gives users complete control over nacks.
@atheriel atheriel mentioned this pull request Nov 11, 2020
@atheriel atheriel merged commit 5f55c6b into master Mar 11, 2021
@atheriel atheriel deleted the ack-and-nack branch March 11, 2021 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant