pub struct MessageEnvelope {
pub pattern: String,
pub payload: Value,
pub metadata: TransportMetadata,
}Expand description
MessageEnvelope
A request-response style message sent between microservices. Contains the pattern, payload, and optional metadata.
Fields§
§pattern: String§payload: Value§metadata: TransportMetadataImplementations§
Source§impl MessageEnvelope
impl MessageEnvelope
Sourcepub fn new(pattern: impl Into<String>, payload: impl Serialize) -> Result<Self>
pub fn new(pattern: impl Into<String>, payload: impl Serialize) -> Result<Self>
Creates a new message envelope.
§Arguments
pattern: The microservice pattern to targetpayload: The message payload (must be serializable)
Sourcepub fn with_metadata(self, metadata: TransportMetadata) -> Self
pub fn with_metadata(self, metadata: TransportMetadata) -> Self
Attaches metadata to the message envelope.
Trait Implementations§
Source§impl Clone for MessageEnvelope
impl Clone for MessageEnvelope
Source§fn clone(&self) -> MessageEnvelope
fn clone(&self) -> MessageEnvelope
Returns a duplicate of the value. Read more
1.0.0 · 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 MessageEnvelope
impl Debug for MessageEnvelope
Source§impl<'de> Deserialize<'de> for MessageEnvelope
impl<'de> Deserialize<'de> for MessageEnvelope
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
Auto Trait Implementations§
impl Freeze for MessageEnvelope
impl RefUnwindSafe for MessageEnvelope
impl Send for MessageEnvelope
impl Sync for MessageEnvelope
impl Unpin for MessageEnvelope
impl UnsafeUnpin for MessageEnvelope
impl UnwindSafe for MessageEnvelope
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