pub trait MessageTrait:
Any
+ Display
+ Debug {
Show 44 methods
// Required methods
fn put_property(&mut self, key: CheetahString, value: CheetahString);
fn clear_property(&mut self, name: &str);
fn property(&self, name: &CheetahString) -> Option<CheetahString>;
fn property_ref(&self, name: &CheetahString) -> Option<&CheetahString>;
fn topic(&self) -> &CheetahString;
fn set_topic(&mut self, topic: CheetahString);
fn get_flag(&self) -> i32;
fn set_flag(&mut self, flag: i32);
fn get_body(&self) -> Option<&Bytes>;
fn set_body(&mut self, body: Bytes);
fn get_properties(&self) -> &HashMap<CheetahString, CheetahString>;
fn set_properties(
&mut self,
properties: HashMap<CheetahString, CheetahString>,
);
fn transaction_id(&self) -> Option<&CheetahString>;
fn set_transaction_id(&mut self, transaction_id: CheetahString);
fn get_compressed_body_mut(&mut self) -> Option<&mut Bytes>;
fn get_compressed_body(&self) -> Option<&Bytes>;
fn set_compressed_body_mut(&mut self, compressed_body: Bytes);
fn take_body(&mut self) -> Option<Bytes>;
fn as_any(&self) -> &dyn Any;
fn as_any_mut(&mut self) -> &mut dyn Any;
// Provided methods
fn set_keys(&mut self, keys: CheetahString) { ... }
fn put_user_property(
&mut self,
name: CheetahString,
value: CheetahString,
) -> RocketMQResult<()> { ... }
fn user_property(&self, name: &CheetahString) -> Option<CheetahString> { ... }
fn user_property_ref(&self, name: &CheetahString) -> Option<&CheetahString> { ... }
fn tags(&self) -> Option<CheetahString> { ... }
fn tags_ref(&self) -> Option<&CheetahString> { ... }
fn set_tags(&mut self, tags: CheetahString) { ... }
fn get_keys(&self) -> Option<CheetahString> { ... }
fn get_keys_ref(&self) -> Option<&CheetahString> { ... }
fn set_keys_from_collection(&mut self, key_collection: Vec<String>) { ... }
fn delay_time_level(&self) -> i32 { ... }
fn set_delay_time_level(&mut self, level: i32) { ... }
fn is_wait_store_msg_ok(&self) -> bool { ... }
fn set_wait_store_msg_ok(&mut self, wait_store_msg_ok: bool) { ... }
fn set_instance_id(&mut self, instance_id: CheetahString) { ... }
fn buyer_id(&self) -> Option<CheetahString> { ... }
fn buyer_id_ref(&self) -> Option<&CheetahString> { ... }
fn set_buyer_id(&mut self, buyer_id: CheetahString) { ... }
fn set_delay_time_sec(&mut self, sec: u64) { ... }
fn get_delay_time_sec(&self) -> u64 { ... }
fn set_delay_time_ms(&mut self, time_ms: u64) { ... }
fn get_delay_time_ms(&self) -> u64 { ... }
fn set_deliver_time_ms(&mut self, time_ms: u64) { ... }
fn get_deliver_time_ms(&self) -> u64 { ... }
}Expand description
Defines the interface for RocketMQ message operations.
Provides methods for managing message properties, keys, tags, body, and metadata.
Required Methods§
Sourcefn put_property(&mut self, key: CheetahString, value: CheetahString)
fn put_property(&mut self, key: CheetahString, value: CheetahString)
Adds a property to the message.
Sourcefn clear_property(&mut self, name: &str)
fn clear_property(&mut self, name: &str)
Removes the specified property from the message.
Sourcefn property(&self, name: &CheetahString) -> Option<CheetahString>
fn property(&self, name: &CheetahString) -> Option<CheetahString>
Retrieves a property value.
Sourcefn property_ref(&self, name: &CheetahString) -> Option<&CheetahString>
fn property_ref(&self, name: &CheetahString) -> Option<&CheetahString>
Retrieves a reference to a property value.
Sourcefn topic(&self) -> &CheetahString
fn topic(&self) -> &CheetahString
Returns the topic of the message.
Sourcefn set_topic(&mut self, topic: CheetahString)
fn set_topic(&mut self, topic: CheetahString)
Sets the topic for the message.
Sourcefn get_properties(&self) -> &HashMap<CheetahString, CheetahString>
fn get_properties(&self) -> &HashMap<CheetahString, CheetahString>
Returns all properties associated with the message.
Sourcefn set_properties(&mut self, properties: HashMap<CheetahString, CheetahString>)
fn set_properties(&mut self, properties: HashMap<CheetahString, CheetahString>)
Sets multiple properties for the message.
Sourcefn transaction_id(&self) -> Option<&CheetahString>
fn transaction_id(&self) -> Option<&CheetahString>
Retrieves the transaction ID associated with the message.
§Returns
A reference to the transaction ID as a &str.
Sourcefn set_transaction_id(&mut self, transaction_id: CheetahString)
fn set_transaction_id(&mut self, transaction_id: CheetahString)
Sets the transaction ID for the message.
Sourcefn get_compressed_body_mut(&mut self) -> Option<&mut Bytes>
fn get_compressed_body_mut(&mut self) -> Option<&mut Bytes>
Returns a mutable reference to the compressed body of the message.
Sourcefn get_compressed_body(&self) -> Option<&Bytes>
fn get_compressed_body(&self) -> Option<&Bytes>
Returns a reference to the compressed body of the message.
Sourcefn set_compressed_body_mut(&mut self, compressed_body: Bytes)
fn set_compressed_body_mut(&mut self, compressed_body: Bytes)
Sets the compressed body of the message.
Sourcefn take_body(&mut self) -> Option<Bytes>
fn take_body(&mut self) -> Option<Bytes>
Takes ownership of the message body, leaving it empty.
Sourcefn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Returns a mutable reference to the message as a trait object.
Provided Methods§
Sourcefn set_keys(&mut self, keys: CheetahString)
fn set_keys(&mut self, keys: CheetahString)
Sets the keys for the message.
Sourcefn put_user_property(
&mut self,
name: CheetahString,
value: CheetahString,
) -> RocketMQResult<()>
fn put_user_property( &mut self, name: CheetahString, value: CheetahString, ) -> RocketMQResult<()>
Adds a user-defined property to the message.
§Errors
Returns an error if the property name is reserved by the system or if the name or value is empty.
Sourcefn user_property(&self, name: &CheetahString) -> Option<CheetahString>
fn user_property(&self, name: &CheetahString) -> Option<CheetahString>
Retrieves a user-defined property value.
Sourcefn user_property_ref(&self, name: &CheetahString) -> Option<&CheetahString>
fn user_property_ref(&self, name: &CheetahString) -> Option<&CheetahString>
Retrieves a reference to a user-defined property value.
Returns the tags associated with the message.
Returns a reference to the tags associated with the message.
Sets the tags for the message.
Sourcefn get_keys(&self) -> Option<CheetahString>
fn get_keys(&self) -> Option<CheetahString>
Returns the keys associated with the message.
Sourcefn get_keys_ref(&self) -> Option<&CheetahString>
fn get_keys_ref(&self) -> Option<&CheetahString>
Returns a reference to the keys associated with the message.
Sourcefn set_keys_from_collection(&mut self, key_collection: Vec<String>)
fn set_keys_from_collection(&mut self, key_collection: Vec<String>)
Sets the message keys from a collection, joining them with spaces.
Sourcefn delay_time_level(&self) -> i32
fn delay_time_level(&self) -> i32
Returns the delay time level of the message, or 0 if not set.
Sourcefn set_delay_time_level(&mut self, level: i32)
fn set_delay_time_level(&mut self, level: i32)
Sets the delay time level for the message.
Sourcefn is_wait_store_msg_ok(&self) -> bool
fn is_wait_store_msg_ok(&self) -> bool
Returns whether the message should wait for store acknowledgment.
Defaults to true if not set.
Sourcefn set_wait_store_msg_ok(&mut self, wait_store_msg_ok: bool)
fn set_wait_store_msg_ok(&mut self, wait_store_msg_ok: bool)
Sets whether the message should wait for store acknowledgment.
Sourcefn set_instance_id(&mut self, instance_id: CheetahString)
fn set_instance_id(&mut self, instance_id: CheetahString)
Sets the instance ID for the message.
Sourcefn buyer_id(&self) -> Option<CheetahString>
fn buyer_id(&self) -> Option<CheetahString>
Returns the buyer ID associated with the message.
Sourcefn buyer_id_ref(&self) -> Option<&CheetahString>
fn buyer_id_ref(&self) -> Option<&CheetahString>
Returns a reference to the buyer ID associated with the message.
Sourcefn set_buyer_id(&mut self, buyer_id: CheetahString)
fn set_buyer_id(&mut self, buyer_id: CheetahString)
Sets the buyer ID for the message.
Sourcefn set_delay_time_sec(&mut self, sec: u64)
fn set_delay_time_sec(&mut self, sec: u64)
Sets the delay time for the message in seconds.
Sourcefn get_delay_time_sec(&self) -> u64
fn get_delay_time_sec(&self) -> u64
Returns the delay time for the message in seconds, or 0 if not set.
Sourcefn set_delay_time_ms(&mut self, time_ms: u64)
fn set_delay_time_ms(&mut self, time_ms: u64)
Sets the delay time for the message in milliseconds.
Sourcefn get_delay_time_ms(&self) -> u64
fn get_delay_time_ms(&self) -> u64
Returns the delay time for the message in milliseconds, or 0 if not set.
Sourcefn set_deliver_time_ms(&mut self, time_ms: u64)
fn set_deliver_time_ms(&mut self, time_ms: u64)
Sets the delivery time for the message in milliseconds.
Sourcefn get_deliver_time_ms(&self) -> u64
fn get_deliver_time_ms(&self) -> u64
Returns the delivery time for the message in milliseconds, or 0 if not set.