Skip to main content

LapinMessage

Struct LapinMessage 

Source
pub struct LapinMessage { /* private fields */ }
Expand description

One AMQP delivery, settled with the protocol’s native acknowledgement frames.

Settlement mapping:

  • ack sends basic.ack.
  • nack(true) sends basic.nack with requeue = true; the broker redelivers the message (typically to the same queue, redelivered set).
  • nack(false) sends basic.reject with requeue = false; the broker drops the message, or dead-letters it when the queue has a dead-letter exchange.
  • nack_after(delay) is native only when the subscription set RabbitQueue::delay; otherwise the default reports the delay unsupported and the runtime uses its broker-agnostic fallback.

Replies received through LapinRequester arrive on a no-ack consumer; settling them is a no-op that always succeeds.

Implementations§

Source§

impl LapinMessage

Source

pub fn exchange(&self) -> &str

The exchange this message was published to (empty for the default exchange).

Source

pub fn routing_key(&self) -> &str

The routing key the message was published with.

Source

pub fn redelivered(&self) -> bool

Whether the broker marked this delivery as redelivered.

Source

pub fn delivery_tag(&self) -> u64

The channel-local delivery tag of this delivery.

Trait Implementations§

Source§

impl BuildContext<LapinMessage> for AmqpContext

Source§

fn build(msg: &LapinMessage) -> Self

Builds the context value by reading fields out of msg.
Source§

impl Debug for LapinMessage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl IncomingMessage for LapinMessage

Source§

async fn ack(self) -> Result<(), AckError>

Acknowledges the delivery with basic.ack.

§Errors

Returns AckError::Broker when the frame cannot be sent, for example because the channel closed after the delivery arrived.

§Cancel safety

Not cancel safe: dropping the future after the frame was queued may still acknowledge the message on the broker.

Source§

async fn nack(self, requeue: bool) -> Result<(), AckError>

Settles negatively: basic.nack(requeue = true) or basic.reject(requeue = false).

§Errors

Returns AckError::Broker when the frame cannot be sent, for example because the channel closed after the delivery arrived.

§Cancel safety

Not cancel safe: dropping the future after the frame was queued may still settle the message on the broker.

Source§

fn partition_key(&self) -> Option<&[u8]>

The partition key from the PARTITION_KEY_HEADER, if set. Overridden so keyed worker lanes see it without a Partitioned bound on every dispatch path.

Source§

fn supports_nack_after(&self) -> bool

Whether this delivery can honor a native delayed redelivery.

true only when the subscription set RabbitQueue::delay; otherwise the runtime uses its broker-agnostic deferred re-publish.

Source§

async fn nack_after(self, delay: Duration) -> Result<(), AckError>

Redelivers this message no sooner than delay, natively: re-publish it to the delay waiting queue with a per-message TTL, then acknowledge the original. The waiting queue dead-letters the copy back to the origin queue when the TTL fires.

Duplicate-not-loss: the re-publish is sent on the same channel before the original is acked, so a connection failure between them leaves the original unacked (redelivered), not lost. The one loss window is a missing waiting queue - an unroutable publish to the default exchange is silently dropped - which is why the waiting queue is the user’s declared infrastructure.

§Errors

Returns AckError::Unsupported when the subscription set no delay queue, and AckError::Broker when the re-publish or the ack fails.

§Cancel safety

Not cancel safe: dropping the future may leave the delayed copy published, the original acked, or both.

Source§

fn payload(&self) -> &[u8]

Returns the raw payload of the message.
Source§

fn headers(&self) -> &Headers

Returns the headers attached to the message.
Source§

impl Partitioned for LapinMessage

Source§

fn partition_key(&self) -> Option<&[u8]>

The partition key from the PARTITION_KEY_HEADER, or None when unset.

Deliveries that share a key are dispatched to the same worker lane under workers(n, by_key); AMQP itself does not interpret the header, so the producer sets it.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CompatExt for T

Source§

fn compat(self) -> Compat<T>
where T: Sized,

Applies the Compat adapter by value. Read more
Source§

fn compat_ref(&self) -> Compat<&T>

Applies the Compat adapter by shared reference. Read more
Source§

fn compat_mut(&mut self) -> Compat<&mut T>

Applies the Compat adapter by mutable reference. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more