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§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§fn transaction(
&self,
) -> impl Future<Output = Result<Self::Transaction, Self::Error>>
fn transaction( &self, ) -> impl Future<Output = 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§type Payload = Lend
type Payload = Lend
basic_publish takes the payload as &[u8] and copies it into the frame it sends, so
this publisher reads the bytes and keeps nothing.
Source§async fn publish(
&self,
msg: OutgoingMessage<'_>,
options: Option<&Self::Options>,
) -> Result<(), Self::Error>
async fn publish( &self, msg: OutgoingMessage<'_>, options: Option<&Self::Options>, ) -> Result<(), Self::Error>
Publishes msg, awaiting the broker confirm (or buffering inside a transaction).
The AMQP basic properties are options resolved over the policy’s defaults. Inside a
transaction they are buffered with the message and resolved at the commit.
§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§type Options = LapinPublishOptions
type Options = LapinPublishOptions
QoS, a priority, an ordering key, whatever this
transport lets one message differ from the next in. Read moreSource§impl TransactionalPublisher for ConfirmsPublisher
impl TransactionalPublisher for ConfirmsPublisher
Source§fn begin_transaction(&self) -> impl Future<Output = Result<(), Self::Error>>
fn begin_transaction(&self) -> impl Future<Output = 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).
Auto Trait Implementations§
impl !RefUnwindSafe for ConfirmsPublisher
impl !UnwindSafe for ConfirmsPublisher
impl Freeze for ConfirmsPublisher
impl Send for ConfirmsPublisher
impl Sync for ConfirmsPublisher
impl Unpin for ConfirmsPublisher
impl UnsafeUnpin for ConfirmsPublisher
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<P> PublishExt for P
impl<P> PublishExt for P
Source§fn message<'a, T>(
&'a self,
value: &'a T,
) -> PublishBuilder<&'a Self, MessageBody<'a, T>, UnnamedCodec, HeadersUnset, <T as OutgoingDestination>::Form>where
T: OutgoingDestination,
fn message<'a, T>(
&'a self,
value: &'a T,
) -> PublishBuilder<&'a Self, MessageBody<'a, T>, UnnamedCodec, HeadersUnset, <T as OutgoingDestination>::Form>where
T: OutgoingDestination,
#[derive(Outgoing)] value, encoded with the crate’s
default codec (name another one with with_codec(..)). A
Serialized value’s bytes leave as they are instead - the wire is
the type’s own (MessageWire), and no codec runs on it. Read moreSource§fn begin(
&self,
) -> impl Future<Output = Result<TransactionScope<'_, Self, UnnamedCodec, AnyDeclared>, Self::Error>> + Sendwhere
Self: Sized + TransactionalPublisher,
fn begin(
&self,
) -> impl Future<Output = Result<TransactionScope<'_, Self, UnnamedCodec, AnyDeclared>, Self::Error>> + Sendwhere
Self: Sized + TransactionalPublisher,
TransactionScope that
owns it. Read moreSource§fn owned_transaction(
&self,
) -> impl Future<Output = Result<TypedTransaction<Self::Transaction, UnnamedCodec, AnyDeclared>, Self::Error>> + Sendwhere
Self: Sized + OwnedTransactions,
fn owned_transaction(
&self,
) -> impl Future<Output = Result<TypedTransaction<Self::Transaction, UnnamedCodec, AnyDeclared>, Self::Error>> + Sendwhere
Self: Sized + OwnedTransactions,
TypedTransaction that owns it. Read more