Metadata

Struct Metadata 

Source
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

Source

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.

Source

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.

Source

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_name
  • causation_message_position
  • causation_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
Source

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.

Source

pub fn clear_reply_stream_name(&mut self)

Clears the reply stream name, setting it to None.

Source

pub fn is_reply(&self) -> bool

Is a reply.

Source

pub fn is_correlated(&self, stream_name: &str) -> bool

Is correlated with another stream name.

Trait Implementations§

Source§

impl Clone for Metadata

Source§

fn clone(&self) -> Metadata

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Metadata

Source§

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

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

impl Default for Metadata

Source§

fn default() -> Metadata

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

impl<'de> Deserialize<'de> for Metadata

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Metadata

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Metadata

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFrom<Option<Value>> for Metadata

Source§

type Error = Error

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

fn try_from(value: Option<Value>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Eq for Metadata

Source§

impl StructuralPartialEq for Metadata

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,