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§
Methods from Deref<Target = Message>§
Sourcepub fn validate(&self) -> Result<(), ValidationError>
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
Sourcepub fn validate_with_limit(
&self,
max_body_bytes: usize,
) -> Result<(), ValidationError>
pub fn validate_with_limit( &self, max_body_bytes: usize, ) -> Result<(), ValidationError>
Validate with custom body size limit
Sourcepub fn has_expires(&self) -> bool
pub fn has_expires(&self) -> bool
Check if the message has an expiration time
Sourcepub fn has_parent(&self) -> bool
pub fn has_parent(&self) -> bool
Check if the message has a parent task
Sourcepub fn is_persistent(&self) -> bool
pub fn is_persistent(&self) -> bool
Check if the message is persistent
Sourcepub fn content_type_str(&self) -> &str
pub fn content_type_str(&self) -> &str
Get the content type as a string slice
Sourcepub fn content_encoding_str(&self) -> &str
pub fn content_encoding_str(&self) -> &str
Get the content encoding as a string slice
Sourcepub fn has_empty_body(&self) -> bool
pub fn has_empty_body(&self) -> bool
Check if the message body is empty
Sourcepub fn retry_count(&self) -> u32
pub fn retry_count(&self) -> u32
Get the retry count (0 if not set)
Sourcepub fn has_correlation_id(&self) -> bool
pub fn has_correlation_id(&self) -> bool
Check if message has a correlation ID
Sourcepub fn correlation_id(&self) -> Option<&str>
pub fn correlation_id(&self) -> Option<&str>
Get the correlation ID
Sourcepub fn is_workflow_message(&self) -> bool
pub fn is_workflow_message(&self) -> bool
Check if this is a workflow message (has parent, root, or group)
Sourcepub fn with_new_id(&self) -> Self
pub fn with_new_id(&self) -> Self
Clone the message with a new task ID
Sourcepub fn to_builder(&self) -> MessageBuilder
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.
Sourcepub fn is_ready_for_execution(&self) -> bool
pub fn is_ready_for_execution(&self) -> bool
Check if the message is ready for immediate execution (not delayed)
Sourcepub fn is_not_expired(&self) -> bool
pub fn is_not_expired(&self) -> bool
Check if the message has not expired yet
Sourcepub fn should_process(&self) -> bool
pub fn should_process(&self) -> bool
Check if the message should be processed (not expired and ready for execution)
Sourcepub fn time_until_eta(&self) -> Option<Duration>
pub fn time_until_eta(&self) -> Option<Duration>
Get the time remaining until ETA (None if no ETA or already past)
Sourcepub fn time_until_expiration(&self) -> Option<Duration>
pub fn time_until_expiration(&self) -> Option<Duration>
Get the time remaining until expiration (None if no expiration or already expired)
Sourcepub fn increment_retry(&mut self) -> u32
pub fn increment_retry(&mut self) -> u32
Increment the retry count (returns new count)