You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: auto-ack and idempotent ack in AMQPQueue.subscribe()
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.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,12 +19,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
19
19
-`session.closed` — `true` when the underlying connection is closed
20
20
-`session.stop()` — cancels reconnection, clears all subscriptions, and closes the connection
21
21
-`AMQPQueue` — reconnect-safe queue handle returned by `session.queue()`, with `publish()`, `subscribe()`, `get()`, `bind()`, `unbind()`, `purge()`, `delete()` ([#186](https://github.com/cloudamqp/amqp-client.js/pull/186))
22
-
-`subscribe(params?, callback?)` accepts `QueueSubscribeParams` — `ConsumeParams` plus an optional `prefetch` that sets channel QoS before each consume, including after reconnect
22
+
-`subscribe(callback)` / `subscribe(params, callback)` — auto-acks after the callback returns; nacks and requeues on throw; call `msg.ack()` / `msg.nack()` inside the callback to override; pass `{ noAck: true }` to skip acking entirely; `requeueOnNack` controls requeue behaviour on error ([#189](https://github.com/cloudamqp/amqp-client.js/pull/189))
23
+
-`subscribe()` / `subscribe(params)` — async-iterator form; auto-acks the previous message when the loop advances; the last message (after `break`) is left unacked; call `msg.ack()` / `msg.nack()` before advancing to override; pass `{ noAck: true }` to skip acking ([#189](https://github.com/cloudamqp/amqp-client.js/pull/189))
23
24
- Subscriptions survive reconnection automatically; the async-iterator form continues yielding without any caller changes
24
25
-`AMQPExchange` — reconnect-safe exchange handle returned by `session.exchange()`, with `publish()`, `bind()`, `unbind()`, `delete()` ([#186](https://github.com/cloudamqp/amqp-client.js/pull/186))
25
26
-`AMQPSubscription` — stable consumer handle across reconnections: exposes `channel`, `consumerTag`, and `cancel()`
26
27
-`AMQPGeneratorSubscription` — extends `AMQPSubscription` with `AsyncIterable<AMQPMessage>` support
27
-
-`QueueSubscribeParams` — exported type combining `ConsumeParams` with `prefetch?`
28
+
-`QueueSubscribeParams` — exported type combining `ConsumeParams` with `prefetch?` and `requeueOnNack?` (default `true`) ([#189](https://github.com/cloudamqp/amqp-client.js/pull/189))
28
29
-`QueuePublishOptions` / `ExchangePublishOptions` — exported types for publish options; both extend `AMQPProperties` with a `confirm?` flag; `ExchangePublishOptions` adds `routingKey?`
29
30
-`ondisconnect` hook on `AMQPBaseClient` (TCP and WebSocket) — fires when the connection drops
0 commit comments