pub struct MessageMetadata { /* private fields */ }Expand description
Metadata carried independently from a strongly typed message payload.
IDs are strings deliberately: applications may generate UUIDs, ULIDs, or another stable representation without forcing a generator into the core.
Implementations§
Source§impl MessageMetadata
impl MessageMetadata
Sourcepub fn new(id: impl Into<MessageId>, created_at: SystemTime) -> Self
pub fn new(id: impl Into<MessageId>, created_at: SystemTime) -> Self
Creates metadata using identity and time supplied by an application boundary. The core intentionally does not read the clock or generate IDs.
Sourcepub fn with_correlation_id(
self,
correlation_id: impl Into<CorrelationId>,
) -> Self
pub fn with_correlation_id( self, correlation_id: impl Into<CorrelationId>, ) -> Self
Attaches a flow correlation identity.
Sourcepub fn with_causation_id(self, causation_id: impl Into<CausationId>) -> Self
pub fn with_causation_id(self, causation_id: impl Into<CausationId>) -> Self
Attaches the identity of the directly causing message.
Sourcepub fn with_initiated_by(self, initiated_by: impl Into<String>) -> Self
pub fn with_initiated_by(self, initiated_by: impl Into<String>) -> Self
Attaches the actor or system that initiated the flow.
Sourcepub fn with_source(self, source: impl Into<String>) -> Self
pub fn with_source(self, source: impl Into<String>) -> Self
Attaches the logical source component.
Sourcepub const fn created_at(&self) -> SystemTime
pub const fn created_at(&self) -> SystemTime
Returns the externally supplied creation time.
Sourcepub const fn correlation_id(&self) -> Option<&CorrelationId>
pub const fn correlation_id(&self) -> Option<&CorrelationId>
Returns the optional correlation identity.
Sourcepub const fn causation_id(&self) -> Option<&CausationId>
pub const fn causation_id(&self) -> Option<&CausationId>
Returns the optional causation identity.
Sourcepub fn initiated_by(&self) -> Option<&str>
pub fn initiated_by(&self) -> Option<&str>
Returns the optional initiating actor.
Trait Implementations§
Source§impl Clone for MessageMetadata
impl Clone for MessageMetadata
Source§fn clone(&self) -> MessageMetadata
fn clone(&self) -> MessageMetadata
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 moreSource§impl Debug for MessageMetadata
impl Debug for MessageMetadata
impl Eq for MessageMetadata
Source§impl PartialEq for MessageMetadata
impl PartialEq for MessageMetadata
impl StructuralPartialEq for MessageMetadata
Auto Trait Implementations§
impl Freeze for MessageMetadata
impl RefUnwindSafe for MessageMetadata
impl Send for MessageMetadata
impl Sync for MessageMetadata
impl Unpin for MessageMetadata
impl UnsafeUnpin for MessageMetadata
impl UnwindSafe for MessageMetadata
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