Envelope

Struct Envelope 

Source
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>

Source

pub fn delivery_tag(&self) -> u64

Exposes the delivery tag of the underlying incoming message.

Source

pub fn exchange(&self) -> &str

Exposes the original target exchange used to send the underlying incoming message.

Source

pub fn routing_key(&self) -> &str

Exposes the original routing key used to send the underlying incoming message.

Source

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.

Source

pub fn bytes(&self) -> &[u8]

Exposes the original bytes of this message.

Source

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.

Source

pub fn attempt(&self) -> Option<u32>

Exposes the attempt number of the underlying incoming message, if present.

Source

pub fn delivery_mode(&self) -> Option<DeliveryMode>

Exposes the delivery mode of the underlying incoming message, if present.

Source

pub fn priority(&self) -> Option<u8>

Exposes the priority of the underlying incoming message, if present.

Source

pub fn timestamp(&self) -> Option<u64>

Exposes the timestamp of the underlying incoming message, if present.

Source§

impl<T> Envelope<T>

Source

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.

Source

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.

Source

pub fn header<'a, R>(&'a self, key: &str) -> Option<R>
where AMQPValue: Coerce<'a, R>,

Reports the header value from this message by key, if present, coercing it into type R, if supported.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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>

Source

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.

Source

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.

Source

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.

Source

pub async fn abandon(self)

Abandons 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.

Trait Implementations§

Source§

impl<T: Debug> Debug for Envelope<T>

Source§

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

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

impl<T> Drop for Envelope<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<T> !Freeze for Envelope<T>

§

impl<T> !RefUnwindSafe for Envelope<T>

§

impl<T> Send for Envelope<T>
where T: Send,

§

impl<T> Sync for Envelope<T>
where T: Sync,

§

impl<T> Unpin for Envelope<T>
where T: Unpin,

§

impl<T> !UnwindSafe for Envelope<T>

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> 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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
Source§

impl<T> ErasedDestructor for T
where T: 'static,