pub struct BasicProperties { /* private fields */ }Expand description
AMQP message properties.
User is recommended to use the chainable setter to create desired propertities.
See also message properties.
§Example
let basic_props = BasicProperties::default()
.with_content_type("application/json")
.with_persistence(true)
.with_message_type("app1.notifications.orders.created")
.with_app_id("app1")
.finish();Implementations§
Source§impl BasicProperties
impl BasicProperties
Sourcepub fn new(
content_type: Option<String>,
content_encoding: Option<String>,
headers: Option<FieldTable>,
delivery_mode: Option<u8>,
priority: Option<u8>,
correlation_id: Option<String>,
reply_to: Option<String>,
expiration: Option<String>,
message_id: Option<String>,
timestamp: Option<u64>,
message_type: Option<String>,
user_id: Option<String>,
app_id: Option<String>,
cluster_id: Option<String>,
) -> BasicProperties
pub fn new( content_type: Option<String>, content_encoding: Option<String>, headers: Option<FieldTable>, delivery_mode: Option<u8>, priority: Option<u8>, correlation_id: Option<String>, reply_to: Option<String>, expiration: Option<String>, message_id: Option<String>, timestamp: Option<u64>, message_type: Option<String>, user_id: Option<String>, app_id: Option<String>, cluster_id: Option<String>, ) -> BasicProperties
Returns a new instance.
pub fn content_type(&self) -> Option<&String>
Sourcepub fn with_content_type(&mut self, content_type: &str) -> &mut BasicProperties
pub fn with_content_type(&mut self, content_type: &str) -> &mut BasicProperties
pub fn content_encoding(&self) -> Option<&String>
Sourcepub fn with_content_encoding(
&mut self,
content_encoding: &str,
) -> &mut BasicProperties
pub fn with_content_encoding( &mut self, content_encoding: &str, ) -> &mut BasicProperties
pub fn headers(&self) -> Option<&FieldTable>
Sourcepub fn with_headers(&mut self, headers: FieldTable) -> &mut BasicProperties
pub fn with_headers(&mut self, headers: FieldTable) -> &mut BasicProperties
pub fn delivery_mode(&self) -> Option<u8>
Sourcepub fn with_delivery_mode(&mut self, delivery_mode: u8) -> &mut BasicProperties
pub fn with_delivery_mode(&mut self, delivery_mode: u8) -> &mut BasicProperties
Chainable setter of delivery mode. Prefer with_persistence as it is more to the point.
delivery_mode: either DELIVERY_MODE_TRANSIENT or DELIVERY_MODE_PERSISTENT
§Default: None
§Example
let basic_props = BasicProperties::default()
.with_content_type("application/json")
.with_delivery_mode(DELIVERY_MODE_PERSISTENT)
.finish();Sourcepub fn with_persistence(&mut self, persistent: bool) -> &mut BasicProperties
pub fn with_persistence(&mut self, persistent: bool) -> &mut BasicProperties
Marks a message as persistent (or not) using a boolean. When in doubt, prefer publishing messages as persistent.
persistent: true for persistent delivery mode (2), false for transient (1)
with_persistence(true) is equivalent to with_delivery_mode(DELIVERY_MODE_PERSISTENT).
with_persistence(false) is equivalent to with_delivery_mode(DELIVERY_MODE_TRANSIENT).
§Example
use amqprs::BasicProperties;
use amqprs::{DELIVERY_MODE_PERSISTENT, DELIVERY_MODE_TRANSIENT};
let mut prop1 = BasicProperties::default()
.with_persistence(true)
.finish();
let mut prop2 = BasicProperties::default()
.with_delivery_mode(DELIVERY_MODE_PERSISTENT)
.finish();
assert_eq!(prop1.delivery_mode(), prop2.delivery_mode());
prop1.with_persistence(false);
prop2.with_delivery_mode(DELIVERY_MODE_TRANSIENT);
assert_eq!(prop1.delivery_mode(), prop2.delivery_mode());pub fn priority(&self) -> Option<u8>
Sourcepub fn with_priority(&mut self, priority: u8) -> &mut BasicProperties
pub fn with_priority(&mut self, priority: u8) -> &mut BasicProperties
pub fn correlation_id(&self) -> Option<&String>
Sourcepub fn with_correlation_id(
&mut self,
correlation_id: &str,
) -> &mut BasicProperties
pub fn with_correlation_id( &mut self, correlation_id: &str, ) -> &mut BasicProperties
pub fn reply_to(&self) -> Option<&String>
Sourcepub fn with_reply_to(&mut self, reply_to: &str) -> &mut BasicProperties
pub fn with_reply_to(&mut self, reply_to: &str) -> &mut BasicProperties
pub fn expiration(&self) -> Option<&String>
Sourcepub fn with_expiration(&mut self, expiration: &str) -> &mut BasicProperties
pub fn with_expiration(&mut self, expiration: &str) -> &mut BasicProperties
pub fn message_id(&self) -> Option<&String>
Sourcepub fn with_message_id(&mut self, message_id: &str) -> &mut BasicProperties
pub fn with_message_id(&mut self, message_id: &str) -> &mut BasicProperties
pub fn timestamp(&self) -> Option<u64>
Sourcepub fn with_timestamp(&mut self, timestamp: u64) -> &mut BasicProperties
pub fn with_timestamp(&mut self, timestamp: u64) -> &mut BasicProperties
pub fn message_type(&self) -> Option<&String>
Sourcepub fn with_message_type(&mut self, message_type: &str) -> &mut BasicProperties
pub fn with_message_type(&mut self, message_type: &str) -> &mut BasicProperties
pub fn user_id(&self) -> Option<&String>
Sourcepub fn with_user_id(&mut self, user_id: &str) -> &mut BasicProperties
pub fn with_user_id(&mut self, user_id: &str) -> &mut BasicProperties
pub fn app_id(&self) -> Option<&String>
Sourcepub fn with_app_id(&mut self, app_id: &str) -> &mut BasicProperties
pub fn with_app_id(&mut self, app_id: &str) -> &mut BasicProperties
pub fn cluster_id(&self) -> Option<&String>
Sourcepub fn with_cluster_id(&mut self, cluster_id: &str) -> &mut BasicProperties
pub fn with_cluster_id(&mut self, cluster_id: &str) -> &mut BasicProperties
Sourcepub fn finish(&mut self) -> BasicProperties
pub fn finish(&mut self) -> BasicProperties
Finish chaining and returns a new instance according to chained configurations.
Trait Implementations§
Source§impl Clone for BasicProperties
impl Clone for BasicProperties
Source§fn clone(&self) -> BasicProperties
fn clone(&self) -> BasicProperties
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more