pub struct Envelope<T> { /* private fields */ }Expand description
Represents an incoming RabbitMQ message.
This class owns both the bytes of the original message’s payload and the
decoded (e.g., deserialized) payload T, along with the implementation
details of the original Delivery.
Implementations§
Source§impl<T> Envelope<T>
impl<T> Envelope<T>
Sourcepub fn delivery_tag(&self) -> u64
pub fn delivery_tag(&self) -> u64
Exposes the delivery tag of the underlying incoming message.
Sourcepub fn exchange(&self) -> &str
pub fn exchange(&self) -> &str
Exposes the original target exchange used to send the underlying incoming message.
Sourcepub fn routing_key(&self) -> &str
pub fn routing_key(&self) -> &str
Exposes the original routing key used to send the underlying incoming message.
Sourcepub fn is_redelivered(&self) -> bool
pub fn is_redelivered(&self) -> bool
Exposes the original redelivery flag of the underlying incoming message.
A message is redelivered when it has been previously dropped without finalizing, or if it was previously explicitly backwashed.
Sourcepub fn payload(&self) -> &T
pub fn payload(&self) -> &T
Exposes the decoded payload of this message.
Most decoders derive the payload from the original
bytes of this message. A notable exceptions is the
NoopDecoder.
Sourcepub fn attempt(&self) -> Option<u32>
pub fn attempt(&self) -> Option<u32>
Exposes the attempt number of the underlying incoming message, if present.
Sourcepub fn delivery_mode(&self) -> Option<DeliveryMode>
pub fn delivery_mode(&self) -> Option<DeliveryMode>
Exposes the delivery mode of the underlying incoming message, if present.
Source§impl<T> Envelope<T>
impl<T> Envelope<T>
Sourcepub fn content_type<'a, R>(&'a self) -> Option<R>where
ShortString: Coerce<'a, R>,
pub fn content_type<'a, R>(&'a self) -> Option<R>where
ShortString: Coerce<'a, R>,
Reports the content type of this message, if present, coercing
it into type R, if supported.
Sourcepub fn content_encoding<'a, R>(&'a self) -> Option<R>where
ShortString: Coerce<'a, R>,
pub fn content_encoding<'a, R>(&'a self) -> Option<R>where
ShortString: Coerce<'a, R>,
Reports the content encoding of this message, if present,
coercing it into type R, if supported.
Sourcepub fn header<'a, R>(&'a self, key: &str) -> Option<R>
pub fn header<'a, R>(&'a self, key: &str) -> Option<R>
Reports the header value from this message by key, if present,
coercing it into type R, if supported.
Sourcepub fn correlation_id<'a, R>(&'a self) -> Option<R>where
ShortString: Coerce<'a, R>,
pub fn correlation_id<'a, R>(&'a self) -> Option<R>where
ShortString: Coerce<'a, R>,
Reports the correlation ID of this message, if present,
coercing it into type R, if supported.
Sourcepub fn reply_to<'a, R>(&'a self) -> Option<R>where
ShortString: Coerce<'a, R>,
pub fn reply_to<'a, R>(&'a self) -> Option<R>where
ShortString: Coerce<'a, R>,
Reports the “reply-to” value of this message, if present,
coercing it into type R, if supported.
Sourcepub fn expiration<'a, R>(&'a self) -> Option<R>where
ShortString: Coerce<'a, R>,
pub fn expiration<'a, R>(&'a self) -> Option<R>where
ShortString: Coerce<'a, R>,
Reports the expiration of this message, if present, coercing
it into type R, if supported.
Sourcepub fn message_id<'a, R>(&'a self) -> Option<R>where
ShortString: Coerce<'a, R>,
pub fn message_id<'a, R>(&'a self) -> Option<R>where
ShortString: Coerce<'a, R>,
Reports the ID of this message, if present, coercing it into
type R, if supported.
Sourcepub fn kind<'a, R>(&'a self) -> Option<R>where
ShortString: Coerce<'a, R>,
pub fn kind<'a, R>(&'a self) -> Option<R>where
ShortString: Coerce<'a, R>,
Reports the kind of this message, if present, coercing it into
type R, if supported.
Sourcepub fn user_id<'a, R>(&'a self) -> Option<R>where
ShortString: Coerce<'a, R>,
pub fn user_id<'a, R>(&'a self) -> Option<R>where
ShortString: Coerce<'a, R>,
Reports the user ID of this message, if present, coercing it
into type R, if supported.
Sourcepub fn app_id<'a, R>(&'a self) -> Option<R>where
ShortString: Coerce<'a, R>,
pub fn app_id<'a, R>(&'a self) -> Option<R>where
ShortString: Coerce<'a, R>,
Reports the app ID of this message, if present, coercing it
into type R, if supported.
Sourcepub fn cluster_id<'a, R>(&'a self) -> Option<R>where
ShortString: Coerce<'a, R>,
pub fn cluster_id<'a, R>(&'a self) -> Option<R>where
ShortString: Coerce<'a, R>,
Reports the cluster ID of this message, if present, coercing
it into type R, if supported.
Source§impl<T> Envelope<T>
impl<T> Envelope<T>
Sourcepub fn dispatch_builder(&self) -> DispatchBuilder
pub fn dispatch_builder(&self) -> DispatchBuilder
Copies the bytes of this envelope into a new DispatchBuilder, which
will represent a message almost identical to the one that created this
initial envelope.
The intention of this method is to enable sending an incoming envelope back to RabbitMQ, unchanged, e.g., for the purpose of retrying the processing of the message.
Sourcepub async fn complete(self)
pub async fn complete(self)
Completes the incoming message represented
by this Envelope. If this envelope has already been
finalized (either
automatically, or manually via a method
like this one), this method is a no-op.
Sourcepub async fn backwash(self)
pub async fn backwash(self)
Backwashes the incoming message
represented by this Envelope. If this envelope has already been
finalized (either
automatically, or manually via a method
like this one), this method is a no-op.