PooledMessage

Struct PooledMessage 

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

A pooled message that automatically returns to the pool when dropped

Provides deref access to the underlying message.

Implementations§

Source§

impl PooledMessage

Source

pub fn take(self) -> Message

Take ownership of the message, removing it from pool management

Source

pub fn get(&self) -> &Message

Get a reference to the message

Source

pub fn get_mut(&mut self) -> &mut Message

Get a mutable reference to the message

Methods from Deref<Target = Message>§

Source

pub fn validate(&self) -> Result<(), ValidationError>

Validate the complete message

Validates:

  • Headers (task name, retries, eta/expires)
  • Properties (delivery mode, priority)
  • Content type format
  • Body size
Source

pub fn validate_with_limit( &self, max_body_bytes: usize, ) -> Result<(), ValidationError>

Validate with custom body size limit

Source

pub fn has_eta(&self) -> bool

Check if the message has an ETA (delayed execution)

Source

pub fn has_expires(&self) -> bool

Check if the message has an expiration time

Source

pub fn has_group(&self) -> bool

Check if the message is part of a group

Source

pub fn has_parent(&self) -> bool

Check if the message has a parent task

Source

pub fn has_root(&self) -> bool

Check if the message has a root task

Source

pub fn is_persistent(&self) -> bool

Check if the message is persistent

Source

pub fn task_id(&self) -> Uuid

Get the task ID

Source

pub fn task_name(&self) -> &str

Get the task name

Source

pub fn content_type_str(&self) -> &str

Get the content type as a string slice

Source

pub fn content_encoding_str(&self) -> &str

Get the content encoding as a string slice

Source

pub fn body_size(&self) -> usize

Get the message body size in bytes

Source

pub fn has_empty_body(&self) -> bool

Check if the message body is empty

Source

pub fn retry_count(&self) -> u32

Get the retry count (0 if not set)

Source

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

Get the priority (None if not set)

Source

pub fn has_correlation_id(&self) -> bool

Check if message has a correlation ID

Source

pub fn correlation_id(&self) -> Option<&str>

Get the correlation ID

Source

pub fn reply_to(&self) -> Option<&str>

Get the reply-to queue

Source

pub fn is_workflow_message(&self) -> bool

Check if this is a workflow message (has parent, root, or group)

Source

pub fn with_new_id(&self) -> Self

Clone the message with a new task ID

Source

pub fn to_builder(&self) -> MessageBuilder

Create a builder from this message (for modification)

Note: This creates a new builder with the message’s metadata. The body (args/kwargs) must be set separately on the builder.

Source

pub fn is_ready_for_execution(&self) -> bool

Check if the message is ready for immediate execution (not delayed)

Source

pub fn is_not_expired(&self) -> bool

Check if the message has not expired yet

Source

pub fn should_process(&self) -> bool

Check if the message should be processed (not expired and ready for execution)

Source

pub fn time_until_eta(&self) -> Option<Duration>

Get the time remaining until ETA (None if no ETA or already past)

Source

pub fn time_until_expiration(&self) -> Option<Duration>

Get the time remaining until expiration (None if no expiration or already expired)

Source

pub fn increment_retry(&mut self) -> u32

Increment the retry count (returns new count)

Trait Implementations§

Source§

impl Deref for PooledMessage

Source§

type Target = Message

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for PooledMessage

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl Drop for PooledMessage

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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<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, 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.