pub struct Exchange {
pub in_msg: Message,
pub out_msg: Option<Message>,
pub properties: HashMap<String, String>,
}Expand description
An exchange wraps an inbound and outbound message, plus routing properties.
§Inbound vs Outbound
in_msg– original message entering the pipeline.out_msg– optional transformed result set by processors (e.g. formatter, enricher).
§Properties
Free-form key/value pairs for internal routing state (e.g. retry count, timing info). Not automatically serialized; use headers for externally visible metadata.
§Correlation Helper
Exchange::correlation_id provides a convenience wrapper around in_msg.ensure_correlation_id().
Fields§
§in_msg: MessageThe inbound message.
out_msg: Option<Message>The outbound message, if set.
properties: HashMap<String, String>Arbitrary string properties for routing or context.
Implementations§
Source§impl Exchange
impl Exchange
Sourcepub fn set_property<K, V>(&mut self, k: K, v: V)
pub fn set_property<K, V>(&mut self, k: K, v: V)
Sets a property key-value pair.
Sourcepub fn correlation_id(&mut self) -> &str
pub fn correlation_id(&mut self) -> &str
Ensures the inbound message has a correlation id, returning it.
Equivalent to self.in_msg.ensure_correlation_id(); provided for ergonomic chaining
in routing code.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Exchange
impl<'de> Deserialize<'de> for Exchange
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Exchange, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Exchange, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Exchange
impl Serialize for Exchange
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for Exchange
impl RefUnwindSafe for Exchange
impl Send for Exchange
impl Sync for Exchange
impl Unpin for Exchange
impl UnwindSafe for Exchange
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