pub struct MessageContext { /* private fields */ }Expand description
Re-exported public API. Context made available to a microservice handler.
Implementations§
Source§impl MessageContext
impl MessageContext
Sourcepub fn new(
subject: impl Into<String>,
headers: BTreeMap<String, String>,
correlation_id: Option<String>,
deadline: Option<SystemTime>,
cancellation: CancellationToken,
delivery: Option<MessageDelivery>,
event_id: Option<String>,
) -> Self
pub fn new( subject: impl Into<String>, headers: BTreeMap<String, String>, correlation_id: Option<String>, deadline: Option<SystemTime>, cancellation: CancellationToken, delivery: Option<MessageDelivery>, event_id: Option<String>, ) -> Self
Creates a context for a transport delivery.
Sourcepub fn headers(&self) -> &BTreeMap<String, String>
pub fn headers(&self) -> &BTreeMap<String, String>
Application headers propagated by the transport.
Sourcepub fn correlation_id(&self) -> Option<&str>
pub fn correlation_id(&self) -> Option<&str>
The request correlation identifier, when this is a command.
Sourcepub fn deadline(&self) -> Option<SystemTime>
pub fn deadline(&self) -> Option<SystemTime>
The requested deadline, when one was propagated.
Sourcepub fn cancellation_token(&self) -> &CancellationToken
pub fn cancellation_token(&self) -> &CancellationToken
A token cancelled when the application begins shutdown.
Sourcepub fn delivery(&self) -> Option<&MessageDelivery>
pub fn delivery(&self) -> Option<&MessageDelivery>
Delivery metadata for durable events.
Sourcepub fn delivery_attempt(&self) -> u64
pub fn delivery_attempt(&self) -> u64
The one-based delivery attempt, or zero for non-durable commands.
Trait Implementations§
Source§impl Clone for MessageContext
impl Clone for MessageContext
Source§fn clone(&self) -> MessageContext
fn clone(&self) -> MessageContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MessageContext
impl RefUnwindSafe for MessageContext
impl Send for MessageContext
impl Sync for MessageContext
impl Unpin for MessageContext
impl UnsafeUnpin for MessageContext
impl UnwindSafe for MessageContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more