Skip to main content

MqMessage

Struct MqMessage 

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

A message published to and consumed from a MessageBroker.

Implementations§

Source§

impl MqMessage

Inherent implementation of MqMessage.

Source

pub fn new<T, P>(topic: T, payload: P) -> Self
where T: Into<String>, P: Into<Vec<u8>>,

Creates a new message targeting topic with raw payload bytes.

§Arguments
  • T - Topic name convertible into String.
  • P - Payload bytes convertible into Vec<u8>.
§Returns
  • Self - Newly constructed message stamped with the current epoch millisecond.
Source

pub fn with_key<K>(self, key: K) -> Self
where K: Into<String>,

Sets an optional routing or partitioning key.

§Arguments
  • K - Routing key convertible into String.
§Returns
  • Self - Updated message.
Source

pub fn with_header<K, V>(self, key: K, value: V) -> Self
where K: Into<String>, V: Into<String>,

Inserts a metadata header key-value pair on this message.

§Arguments
  • K - Header key convertible into String.
  • V - Header value convertible into String.
§Returns
  • Self - Updated message.
Source

pub fn with_ttl_ms(self, ttl_ms: u64) -> Self

Configures a relative time-to-live in milliseconds from creation time.

§Arguments
  • u64 - TTL in milliseconds.
§Returns
  • Self - Updated message with expires_at_ms set.
Source

pub fn with_max_retries(self, max_retries: u32) -> Self

Overrides the maximum delivery attempts before dead-lettering.

§Arguments
  • u32 - Maximum attempts allowed for this message.
§Returns
  • Self - Updated message.
Source§

impl MqMessage

Source

pub fn get_id(&self) -> u64

Source

pub fn get_mut_id(&mut self) -> &mut u64

Source

pub fn set_id(&mut self, val: u64) -> &mut Self

Source

pub fn get_topic(&self) -> &String

Source

pub fn get_mut_topic(&mut self) -> &mut String

Source

pub fn set_topic(&mut self, val: String) -> &mut Self

Source

pub fn get_key(&self) -> Option<String>

Source

pub fn try_get_key(&self) -> Option<String>

Source

pub fn get_mut_key(&mut self) -> &mut Option<String>

Source

pub fn set_key(&mut self, val: Option<String>) -> &mut Self

Source

pub fn get_payload(&self) -> &Vec<u8> ⓘ

Source

pub fn get_mut_payload(&mut self) -> &mut Vec<u8> ⓘ

Source

pub fn set_payload(&mut self, val: Vec<u8>) -> &mut Self

Source

pub fn get_headers(&self) -> &HashMap<String, String>

Source

pub fn get_mut_headers(&mut self) -> &mut HashMap<String, String>

Source

pub fn set_headers(&mut self, val: HashMap<String, String>) -> &mut Self

Source

pub fn get_attempts(&self) -> u32

Source

pub fn get_mut_attempts(&mut self) -> &mut u32

Source

pub fn set_attempts(&mut self, val: u32) -> &mut Self

Source

pub fn get_max_retries(&self) -> u32

Source

pub fn get_mut_max_retries(&mut self) -> &mut u32

Source

pub fn set_max_retries(&mut self, val: u32) -> &mut Self

Source

pub fn get_created_at_ms(&self) -> u64

Source

pub fn get_mut_created_at_ms(&mut self) -> &mut u64

Source

pub fn set_created_at_ms(&mut self, val: u64) -> &mut Self

Source

pub fn get_expires_at_ms(&self) -> Option<u64>

Source

pub fn try_get_expires_at_ms(&self) -> Option<u64>

Source

pub fn get_mut_expires_at_ms(&mut self) -> &mut Option<u64>

Source

pub fn set_expires_at_ms(&mut self, val: Option<u64>) -> &mut Self

Trait Implementations§

Source§

impl Clone for MqMessage

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MqMessage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MqMessage

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for MqMessage

Source§

impl PartialEq for MqMessage

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MqMessage

Auto Trait Implementations§

§

impl Forget for MqMessage

§

impl Freeze for MqMessage

§

impl Move for MqMessage

§

impl RefUnwindSafe for MqMessage

§

impl Send for MqMessage
where RawVecInner: Send, RawTable<(String, String)>: Send,

§

impl Sync for MqMessage
where RawVecInner: Sync, RawTable<(String, String)>: Sync,

§

impl Unpin for MqMessage
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for MqMessage

§

impl UnwindSafe for MqMessage
where RawVecInner: UnwindSafe, HashMap<String, String>: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.