pub struct Metadata {
pub stream_name: Option<StreamName>,
pub position: Option<i64>,
pub global_position: Option<i64>,
pub causation_message_stream_name: Option<StreamName>,
pub causation_message_position: Option<i64>,
pub causation_message_global_position: Option<i64>,
pub correlation_stream_name: Option<String>,
pub reply_stream_name: Option<String>,
pub schema_version: Option<String>,
pub properties: HashMap<String, Value>,
pub local_properties: HashMap<String, Value>,
}Expand description
A message’s metadata object contains information about the stream where the message resides, the previous message in a series of messages that make up a messaging workflow, the originating process to which the message belongs, as well as other data that are pertinent to understanding the provenance and disposition of the message.
Where as a message’s data represents information pertinent to the business process that the message is involved with, a message’s metadata contains information that is mechanical and infrastructural. Message metadata is data about messaging machinery, like message schema version, source stream, positions, provenance, reply address, and the like.
Fields§
§stream_name: Option<StreamName>The name of the stream where the message resides.
position: Option<i64>The sequential position of the message in its stream.
global_position: Option<i64>The sequential position of the message in the entire message store.
causation_message_stream_name: Option<StreamName>The stream name of the message that precedes the message in a sequential message flow.
causation_message_position: Option<i64>The sequential position of the causation message in its stream.
causation_message_global_position: Option<i64>The sequential position of the message in the entire message store.
correlation_stream_name: Option<String>Name of the stream that represents an encompassing business process that coordinates the sub-process that the message is a part of.
reply_stream_name: Option<String>Name of a stream where a reply should be sent as a result of processing the message.
schema_version: Option<String>Version identifier of the message schema itself.
properties: HashMap<String, Value>Additional properties.
local_properties: HashMap<String, Value>Additional local properties.
Implementations§
Source§impl Metadata
impl Metadata
Sourcepub fn identifier(&self) -> Option<String>
pub fn identifier(&self) -> Option<String>
The de facto unique identifier for a message is a combination of the message’s stream name and the message’s position number within that stream.
Returns the identifier is formatted as a URI fragment of the form stream_name/position.
Sourcepub fn causation_message_identifier(&self) -> Option<String>
pub fn causation_message_identifier(&self) -> Option<String>
The unique identifier for a message’s causation message is a combination of the causation message’s stream name and the causation message’s position number within that stream.
Returns the identifier is formatted as a URI fragment of the form
causation_message_stream_name/causation_message_position.
Sourcepub fn follow(&mut self, preceding_metadata: Metadata)
pub fn follow(&mut self, preceding_metadata: Metadata)
When messages represent subsequent steps in a workflow, a subsequent message’s metadata records elements of the preceding message’s metadata. Each message in a workflow carries provenance data of the message that precedes it.
The message’s implementation of follow specifically manages the
transfer of message data from the preceding message to the
subsequent method, and then delegates to the metadata object to
manage the transfer of message flow and provenance data between the
two metadata objects.
There are three metadata attributes that comprise the identifying information of a message’s preceding message. They are collectively referred to as causation data.
causation_message_stream_namecausation_message_positioncausation_message_global_position
Each message’s metadata in a workflow may also carry identifying information about the overall or coordinating workflow that the messages participates in. That identifying information is referred to as correlation data.
correlation_stream_name
Additionally, a message’s metadata may carry a reply address:
reply_stream_name
Sourcepub fn follows(&self, preceding_metadata: &Metadata) -> bool
pub fn follows(&self, preceding_metadata: &Metadata) -> bool
Metadata objects can be determined to follow each other using the metadata’s follows? predicate method.
Returns true when the metadata’s causation and provenance attributes
match the metadata argument’s message source attributes.
Sourcepub fn clear_reply_stream_name(&mut self)
pub fn clear_reply_stream_name(&mut self)
Clears the reply stream name, setting it to None.
Is correlated with another stream name.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Metadata
impl<'de> Deserialize<'de> for Metadata
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Metadata
impl StructuralPartialEq for Metadata
Auto Trait Implementations§
impl Freeze for Metadata
impl RefUnwindSafe for Metadata
impl Send for Metadata
impl Sync for Metadata
impl Unpin for Metadata
impl UnwindSafe for Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more