Conversation
ThomasSarlin
reviewed
Mar 4, 2026
ThomasSarlin
reviewed
Mar 4, 2026
b5dcce0 to
95644bc
Compare
7c02987 to
ede9bcd
Compare
Callback form: wraps the user callback to ack on return and nack+requeue on
throw. Pass `{ noAck: true }` to opt out; `requeueOnNack: false` to discard
on error instead of requeuing.
Iterator form: acks the previous message when the loop advances to the next.
The last message (after `break`) is left unacked. Call `msg.ack()` /
`msg.nack()` before advancing to override.
AMQPMessage.ack/nack/reject are now idempotent — calling them more than once
is safe and sends only one wire frame. This lets callback and library both
ack without coordinating.
AMQPConsumer.cancel() is also idempotent via a memoised promise, preventing
a double-basicCancel race when generator cleanup and sub.cancel() overlap.
Member
Author
Indeed :) Ready now I think. |
antondalgren
reviewed
Mar 5, 2026
| messageCount?: number | ||
| replyCode?: number | ||
| replyText?: string | ||
| #acked = false |
Contributor
There was a problem hiding this comment.
Why is the variable prefixed with #?
Member
Author
There was a problem hiding this comment.
It's a javascript feature: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_elements
It's stricter than TypeScript's private keyword, which is only a compile-time check. #foo is enforced at runtime by the JS engine.
Contributor
There was a problem hiding this comment.
Why did we decide on making use of it here?
Member
Author
There was a problem hiding this comment.
No particular reason. We should probably start using it more.
antondalgren
approved these changes
Mar 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
subscribe(callback)/subscribe(params, callback)): wraps the callback tomsg.ack()on return andmsg.nack(requeue)on throw. Pass{ noAck: true }to opt out;requeueOnNack: falseto discard on error instead of requeuing.subscribe()/subscribe(params?)): acks the previous message when the loop advances to the next. The last message (afterbreak) is left unacked. Callmsg.ack()/msg.nack()before advancing to override; pass{ noAck: true }to opt out.AMQPMessage.ack/nack/rejectare now idempotent — calling them more than once sends only one wire frame, so the library and user code can both ack without coordinating.AMQPConsumer.cancel()is idempotent via a memoised promise, preventing a double-basicCancelrace when generator cleanup andsub.cancel()overlap.Test plan
requeueOnNack: falseto avoid requeue loop)noAck: truemsg.ack()noAck: truemsg.ack()