pub struct DeliveryMetadata { /* private fields */ }Expand description
English:
Owned delivery identifiers, independent of the domain event payload.
Strings are stored without format or emptiness validation. Providing an event identifier does not enforce uniqueness or deduplication; correlation and causation are optional labels.
Attach tracing labels without changing the event identifier.
日本語:
ドメインイベントのペイロードから独立した、所有された配信識別子です。
文字列の形式や空文字列は検証しません。イベント識別子の指定は一意性や重複排除を 強制しません。相関識別子と原因識別子は任意のラベルです。
イベント識別子を変えずにトレース用のラベルを付けます。
§Example / 使用例
use ddd_toolkit_core::DeliveryMetadata;
let metadata = DeliveryMetadata::new("event-1")
.with_correlation_id("request-7")
.with_causation_id("command-2");
assert_eq!(metadata.event_id(), "event-1");
assert_eq!(metadata.correlation_id(), Some("request-7"));
assert_eq!(metadata.causation_id(), Some("command-2"));Implementations§
Source§impl DeliveryMetadata
impl DeliveryMetadata
Sourcepub fn new(event_id: impl Into<String>) -> DeliveryMetadata
pub fn new(event_id: impl Into<String>) -> DeliveryMetadata
English:
Stores event_id after conversion to String, leaving both optional IDs unset.
No identifier validation or generation is performed.
日本語:
event_id を String に変換して保存し、二つの任意識別子は未設定にします。
識別子の検証や生成は行いません。
Sourcepub fn with_correlation_id(self, id: impl Into<String>) -> DeliveryMetadata
pub fn with_correlation_id(self, id: impl Into<String>) -> DeliveryMetadata
English:
Consumes this value and returns it with the correlation ID set to id.
A previously set correlation ID is replaced.
日本語:
自身を消費し、相関識別子を id に設定して返します。
設定済みの相関識別子は置き換えます。
Sourcepub fn with_causation_id(self, id: impl Into<String>) -> DeliveryMetadata
pub fn with_causation_id(self, id: impl Into<String>) -> DeliveryMetadata
English:
Consumes this value and sets the causation ID to id, replacing any prior value.
日本語:
自身を消費し、原因識別子を id に設定します。以前の値は置き換えます。
Sourcepub fn event_id(&self) -> &str
pub fn event_id(&self) -> &str
English:
Borrows the event identifier as stored, without allocating.
日本語:
保存されたイベント識別子を、割り当てなしで借用します。
Sourcepub fn correlation_id(&self) -> Option<&str>
pub fn correlation_id(&self) -> Option<&str>
English:
Borrows the correlation ID, or returns None if it has not been set.
日本語:
相関識別子を借用し、未設定なら None を返します。
Sourcepub fn causation_id(&self) -> Option<&str>
pub fn causation_id(&self) -> Option<&str>
English:
Borrows the causation ID, or returns None when no cause label is stored.
日本語:
原因識別子を借用し、原因のラベルが保存されていなければ None を返します。
Trait Implementations§
Source§impl Clone for DeliveryMetadata
impl Clone for DeliveryMetadata
Source§fn clone(&self) -> DeliveryMetadata
fn clone(&self) -> DeliveryMetadata
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more