pub struct Message {
pub id: Option<String>,
pub name: String,
pub kind: MessageKind,
pub payload: Vec<u8>,
pub content_type: String,
pub metadata: Vec<(String, String)>,
}Expand description
Serializable transport message used by handlers.
Fields§
§id: Option<String>§name: String§kind: MessageKind§payload: Vec<u8>§content_type: String§metadata: Vec<(String, String)>Implementations§
Source§impl Message
impl Message
Sourcepub fn new(name: impl Into<String>, kind: MessageKind, payload: Vec<u8>) -> Self
pub fn new(name: impl Into<String>, kind: MessageKind, payload: Vec<u8>) -> Self
Create a transport message.
Sourcepub fn with_metadata(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add metadata.
Sourcepub fn correlation_id(&self) -> Option<&str>
pub fn correlation_id(&self) -> Option<&str>
Get the correlation id, if present.
Sourcepub fn causation_id(&self) -> Option<&str>
pub fn causation_id(&self) -> Option<&str>
Get the causation id, if present.
Sourcepub fn payload_json<T: DeserializeOwned>(&self) -> Result<T, PayloadDecodeError>
pub fn payload_json<T: DeserializeOwned>(&self) -> Result<T, PayloadDecodeError>
Decode the raw payload as JSON.
Sourcepub fn payload_bitcode<T: DeserializeOwned>(
&self,
) -> Result<T, PayloadDecodeError>
pub fn payload_bitcode<T: DeserializeOwned>( &self, ) -> Result<T, PayloadDecodeError>
Decode the raw payload as bitcode.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Message
impl<'de> Deserialize<'de> for Message
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&OutboxMessage> for Message
impl From<&OutboxMessage> for Message
Source§fn from(outbox: &OutboxMessage) -> Self
fn from(outbox: &OutboxMessage) -> Self
Map a durable outbox row to a canonical transport message.
id← outbox message id (the stable durable id);name←event_type;kind←Commandwhen a point-to-pointdestinationis set, elseEvent;payload← raw codec bytes,content_type=application/octet-stream;metadata← the outbox metadata (correlation/causation/trace/auth) plus framework-derived keys under the reservedSOURCED_METADATA_PREFIXnamespace (payload codec, destination, source-aggregate context) so decode/routing context can never be shadowed by a user metadata key.
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnsafeUnpin for Message
impl UnwindSafe for Message
Blanket Implementations§
Source§impl<T> AggregateBuilder for T
impl<T> AggregateBuilder for T
fn aggregate<A: Aggregate>(self) -> AggregateRepository<Self, A>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Queueable for T
impl<T> Queueable for T
Source§fn queued(self) -> QueuedRepository<Self, InMemoryAsyncLockManager>
fn queued(self) -> QueuedRepository<Self, InMemoryAsyncLockManager>
Wrap with the default async lock manager. Pair with
.aggregate::<T>() for per-aggregate serialization over the async
repository surface.Source§fn queued_with<L: AsyncLockManager>(
self,
lock_manager: L,
) -> QueuedRepository<Self, L>
fn queued_with<L: AsyncLockManager>( self, lock_manager: L, ) -> QueuedRepository<Self, L>
Wrap with a custom async lock manager.