pub struct LapinMessage { /* private fields */ }Expand description
One AMQP delivery, settled with the protocol’s native acknowledgement frames.
Settlement mapping:
acksendsbasic.ack.nack(true)sendsbasic.rejectwithrequeue = true; the broker redelivers the message (typically to the same queue,redeliveredset).nack(false)sendsbasic.rejectwithrequeue = false; the broker drops the message, or dead-letters it when the queue has a dead-letter exchange.
Both settle with basic.reject rather than basic.nack. The two frames are the same
operation on a single delivery, and they differ in one thing that matters: RabbitMQ 4.3
counts a rejection as a delivery a message has spent and does not count a nack. A handler
asking for its message back is a failed attempt, so it is counted, and a quorum queue’s
x-delivery-limit can then end a poison loop on the server.
nack_after(delay)is native only when the subscription setRabbitQueue::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
impl LapinMessage
Sourcepub fn exchange(&self) -> &str
pub fn exchange(&self) -> &str
The exchange this message was published to (empty for the default exchange).
Sourcepub fn routing_key(&self) -> &str
pub fn routing_key(&self) -> &str
The routing key the message was published with.
Sourcepub fn redelivered(&self) -> bool
pub fn redelivered(&self) -> bool
Whether the broker marked this delivery as redelivered.
Sourcepub fn delivery_tag(&self) -> u64
pub fn delivery_tag(&self) -> u64
The channel-local delivery tag of this delivery.
Trait Implementations§
Source§impl BuildContext<LapinMessage> for AmqpContext
impl BuildContext<LapinMessage> for AmqpContext
Source§fn build(msg: &LapinMessage) -> Self
fn build(msg: &LapinMessage) -> Self
msg.Source§impl Debug for LapinMessage
impl Debug for LapinMessage
Source§impl IncomingMessage for LapinMessage
impl IncomingMessage for LapinMessage
Source§async fn ack(self) -> Result<(), AckError>
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>
async fn nack(self, requeue: bool) -> Result<(), AckError>
Settles negatively with basic.reject: back to the queue under requeue = true, away
from it under requeue = false.
The frame is a rejection in both cases, never basic.nack. On one delivery the two are
the same operation - basic.nack only adds the multiple flag this crate never sets -
but a quorum queue counts a rejected delivery and does not count a nacked one, so a
handler’s retry() spends an attempt the server can see and its x-delivery-limit ends
the loop.
§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]>
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 redelivery_count(&self) -> Option<u64>
fn redelivery_count(&self) -> Option<u64>
How many times this message has been delivered, counting this delivery, from the one
counter the server keeps: a quorum queue’s x-delivery-count.
A quorum queue counts a delivery that failed - one whose consumer went away without settling it, and one this crate rejected for a handler that asked for the message back.
None where nothing counted: every delivery off a classic queue, which keeps no counter,
and the first delivery of any message. A classic queue’s redelivered flag is not a count,
and the x-death table a dead-lettered message carries counts the queues it has left
rather than the deliveries it has spent, so neither stands in for the server’s own count.
That is what leaves the framework’s header in charge of a classic queue’s cap, and it is
also what a delayed redelivery through RabbitQueue::delay
reports, because the copy the waiting queue releases is a new message the server counts
from zero.
Source§fn supports_nack_after(&self) -> bool
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>
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 server drops a copy sent to a waiting queue that does not exist, so a subscription whose broker does not declare topology checks for the waiting queue (or the delayed exchange) when it opens, and refuses to open without it.
§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 decode_error(&self) -> Option<&CodecError>
fn decode_error(&self) -> Option<&CodecError>
None when it read the delivery
whole. Read moreSource§impl Partitioned for LapinMessage
impl Partitioned for LapinMessage
Source§fn partition_key(&self) -> Option<&[u8]>
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§
impl !Freeze for LapinMessage
impl !RefUnwindSafe for LapinMessage
impl !UnwindSafe for LapinMessage
impl Send for LapinMessage
impl Sync for LapinMessage
impl Unpin for LapinMessage
impl UnsafeUnpin for LapinMessage
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> 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 more