pub struct ConfirmsPublisher { /* private fields */ }Expand description
The live publisher that awaits broker confirms for every message.
Outside a transaction each publish resolves only once the broker
confirmed the message. Confirms buffer client-side, so this publisher offers both transaction
kinds:
- owned (
OwnedTransactions, the natural fit): everytransactioncall opens an independentConfirmsTransactionthat owns its buffer, so any number can be open on one handle and the handle keeps publishing directly meanwhile; - borrowed (
TransactionalPublisher): the handle carries one buffer betweenbegin_transactionandcommit, so a second begin while one is open errors.
Either way commit publishes the buffer in order and awaits all confirms, and abort
discards it without touching the broker.
Clones share one confirm channel and one handle-level transaction buffer. Like every live
publisher it aliases the connection and may outlive it: after shutdown every operation
reports AmqpError::Closed.
Trait Implementations§
Source§impl Clone for ConfirmsPublisher
impl Clone for ConfirmsPublisher
Source§fn clone(&self) -> ConfirmsPublisher
fn clone(&self) -> ConfirmsPublisher
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConfirmsPublisher
impl Debug for ConfirmsPublisher
Source§impl OwnedTransactions for ConfirmsPublisher
Owned transactions: every transaction call opens an
independent buffer-owning ConfirmsTransaction, so any number can be open concurrently on
one handle, next to (and unaffected by) the handle-level borrowed transaction.
impl OwnedTransactions for ConfirmsPublisher
Owned transactions: every transaction call opens an
independent buffer-owning ConfirmsTransaction, so any number can be open concurrently on
one handle, next to (and unaffected by) the handle-level borrowed transaction.
Source§async fn transaction(&self) -> Result<Self::Transaction, Self::Error>
async fn transaction(&self) -> Result<Self::Transaction, Self::Error>
Opens a transaction owned by the returned value.
§Errors
Infallible in practice: opening allocates a buffer and never touches the broker, exactly
like the borrowed begin_transaction.
Source§type Transaction = ConfirmsTransaction
type Transaction = ConfirmsTransaction
transaction.Source§impl Publisher for ConfirmsPublisher
impl Publisher for ConfirmsPublisher
Source§async fn publish(&self, msg: OutgoingMessage<'_>) -> Result<(), Self::Error>
async fn publish(&self, msg: OutgoingMessage<'_>) -> Result<(), Self::Error>
Publishes msg, awaiting the broker confirm (or buffering inside a transaction).
§Errors
Returns AmqpError::Closed once the broker has shut down and AmqpError::Publish
when the channel rejects the frame or the broker returns a negative confirm.
§Cancel safety
Not cancel safe outside a transaction: dropping the future may leave the message published but unconfirmed. Inside a transaction buffering is synchronous and dropping the future is harmless.
Source§impl TransactionalPublisher for ConfirmsPublisher
impl TransactionalPublisher for ConfirmsPublisher
Source§async fn begin_transaction(&self) -> Result<(), Self::Error>
async fn begin_transaction(&self) -> Result<(), Self::Error>
Opens the buffering transaction.
§Errors
Returns AmqpError::Transaction when a transaction is already open on this handle;
the open transaction is left untouched.
Source§async fn commit(&self) -> Result<(), Self::Error>
async fn commit(&self) -> Result<(), Self::Error>
Publishes the buffered messages in order and awaits every confirm.
§Errors
Returns AmqpError::Transaction when no transaction is open, and
AmqpError::Publish when any message fails to publish or the broker returns a negative
confirm. Messages already flushed stay published: publisher confirms give durability per
message, not atomicity across them (use [ServerTxPublish] for that).