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

Support publish confirmations #61

Merged
merged 5 commits into from
Oct 1, 2021
Merged

Support publish confirmations #61

merged 5 commits into from
Oct 1, 2021

Conversation

achilleasa
Copy link
Owner

This PR introduces support for publish confirmations as described here.

The publish confirmation mechanism is exposed via two new channel-level methods.

  • The confirmPublishedMessages method enables it for a particular channel (further invocations of the method are treated as no-ops).
  • The publishNotifier method allows applications to subscribe to a stream for publish notifications. Each notification contains the original message and message properties as well as a flag which indicates whether the broker handled (e.g. persisted to stable storage) or lost the message.

Note that receiving an ACK for a message does not guarantee that it has been processed by one or more consumers. For example, when publishing to a queue with no consumers, the broker (tested with rabbitmq 3.9.7) will still ACK the message.

The PR also includes an example (in example/confirm) of using this new feature.

Fixes #60

Repository owner deleted a comment from coveralls Sep 29, 2021
The confirm.select/select-ok messages are described in https://www.rabbitmq.com/resources/specs/amqp0-9-1.extended.xml

The Basic.Ack/Nack messages are typically used by clients. However, when
publish confirmations are enabled, the broker will also send these to
the client. To this end, this commit defines the class for Basic.Nack
and adds the "fromStream" factory method so we can unmarshal these
messages when sent by the broker.
This mechanism is exposed via two new channel-level methods.

The confirmPublishedMessages method enables it for a particular channel
(further invocations of the method are treated as no-ops).

The publishNotifier method allows applications to subscribe to a
stream for publish notifications. Each notification contains the
original message and message properties as well as a flag which
indicates whether the broker handled (e.g. persisted to stable storage)
or lost the message.
@achilleasa achilleasa merged commit 41410bf into master Oct 1, 2021
@achilleasa achilleasa deleted the support-confirm branch October 1, 2021 07:01
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.

How to Confirm Publish e.g. Message Sent Successfully?
1 participant