pub struct MessageProperties {
pub content_type: Option<String>,
pub content_encoding: Option<String>,
pub priority: Option<u8>,
pub expiration: Option<u64>,
pub message_type: Option<String>,
pub user_id: Option<String>,
pub app_id: Option<String>,
pub cluster_id: Option<String>,
pub reply_to: Option<String>,
pub headers: Option<HashMap<String, String>>,
}Expand description
Message properties containing backend-specific metadata.
This struct provides a standardized way to capture message properties from different backends (RabbitMQ, Redis Streams, etc.) for use in microservices architectures where you need to track message origin, routing, and other metadata.
Fields§
§content_type: Option<String>Content type of the message payload (e.g., “application/json”)
content_encoding: Option<String>Content encoding (e.g., “utf-8”, “gzip”)
priority: Option<u8>Message priority (if supported by backend)
expiration: Option<u64>Time-to-live or expiration duration in milliseconds
message_type: Option<String>Message type identifier for routing/dispatching
user_id: Option<String>User ID associated with the message
app_id: Option<String>Application ID that sent the message
cluster_id: Option<String>Cluster ID (for federated messaging systems)
reply_to: Option<String>Reply-to address for response messages
headers: Option<HashMap<String, String>>Custom headers/properties specific to the backend Key-value pairs for additional metadata
Implementations§
Source§impl MessageProperties
impl MessageProperties
Sourcepub fn with_content_type(self, content_type: impl Into<String>) -> Self
pub fn with_content_type(self, content_type: impl Into<String>) -> Self
Set content type
Sourcepub fn with_content_encoding(self, encoding: impl Into<String>) -> Self
pub fn with_content_encoding(self, encoding: impl Into<String>) -> Self
Set content encoding
Sourcepub fn with_priority(self, priority: u8) -> Self
pub fn with_priority(self, priority: u8) -> Self
Set message priority
Sourcepub fn with_expiration(self, expiration_ms: u64) -> Self
pub fn with_expiration(self, expiration_ms: u64) -> Self
Set expiration/TTL in milliseconds
Sourcepub fn with_message_type(self, message_type: impl Into<String>) -> Self
pub fn with_message_type(self, message_type: impl Into<String>) -> Self
Set message type
Sourcepub fn with_user_id(self, user_id: impl Into<String>) -> Self
pub fn with_user_id(self, user_id: impl Into<String>) -> Self
Set user ID
Sourcepub fn with_app_id(self, app_id: impl Into<String>) -> Self
pub fn with_app_id(self, app_id: impl Into<String>) -> Self
Set application ID
Sourcepub fn with_cluster_id(self, cluster_id: impl Into<String>) -> Self
pub fn with_cluster_id(self, cluster_id: impl Into<String>) -> Self
Set cluster ID
Sourcepub fn with_reply_to(self, reply_to: impl Into<String>) -> Self
pub fn with_reply_to(self, reply_to: impl Into<String>) -> Self
Set reply-to address
Trait Implementations§
Source§impl Clone for MessageProperties
impl Clone for MessageProperties
Source§fn clone(&self) -> MessageProperties
fn clone(&self) -> MessageProperties
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more