pub struct Exchange {
pub input: Message,
pub output: Option<Message>,
pub properties: HashMap<String, Value>,
pub error: Option<CamelError>,
pub pattern: ExchangePattern,
pub correlation_id: String,
pub otel_context: Context,
}Expand description
An Exchange represents a message being routed through the framework.
It contains the input message, an optional output message, properties for passing data between processors, and error state.
Fields§
§input: MessageThe input (incoming) message.
output: Option<Message>The output (response) message, populated for InOut patterns.
properties: HashMap<String, Value>Exchange-scoped properties for passing data between processors.
error: Option<CamelError>Error state, if processing failed.
pattern: ExchangePatternThe exchange pattern.
correlation_id: StringUnique correlation ID for distributed tracing.
otel_context: ContextOpenTelemetry context for distributed tracing propagation. Carries the active span context between processing steps. Defaults to an empty context (noop span) if OTel is not active.
Implementations§
Source§impl Exchange
impl Exchange
Sourcepub fn new_in_out(input: Message) -> Self
pub fn new_in_out(input: Message) -> Self
Create a new exchange with the InOut pattern.
Sourcepub fn correlation_id(&self) -> &str
pub fn correlation_id(&self) -> &str
Get the correlation ID for this exchange.
Sourcepub fn set_property(&mut self, key: impl Into<String>, value: impl Into<Value>)
pub fn set_property(&mut self, key: impl Into<String>, value: impl Into<Value>)
Set a property value.
Sourcepub fn set_error(&mut self, error: CamelError)
pub fn set_error(&mut self, error: CamelError)
Set an error on this exchange.