pub struct Message {
pub headers: HashMap<String, Value>,
pub body: Body,
}Expand description
A message flowing through the Camel framework.
Fields§
§headers: HashMap<String, Value>Raw message headers (metadata) — a raw escape hatch.
Direct writes to this map bypass header-key normalization, so the map
may contain several keys that differ only by ASCII case. Readers that
need case folding MUST use Message::header_ic instead of indexing
this map directly.
body: BodyMessage body (payload).
Implementations§
Source§impl Message
impl Message
Sourcepub fn header(&self, key: &str) -> Option<&Value>
pub fn header(&self, key: &str) -> Option<&Value>
Get a header value by key, matching the stored key exactly.
Sourcepub fn header_ic(&self, key: &str) -> Option<&Value>
pub fn header_ic(&self, key: &str) -> Option<&Value>
Get a header value, matching case-insensitively.
An exact-case entry wins. Without one, the value whose stored key sorts
first by byte order among the ASCII case-insensitive matches is
returned, so the result does not depend on HashMap iteration order.
Sourcepub fn set_header(&mut self, key: impl Into<String>, value: impl Into<Value>)
pub fn set_header(&mut self, key: impl Into<String>, value: impl Into<Value>)
Set a header value, replacing every ASCII case-insensitive equivalent.
The caller’s spelling is inserted verbatim, so iteration and serialization expose that spelling. This is O(n) in the number of headers.
Sourcepub fn set_header_normalized(
&mut self,
key: impl Into<String>,
value: impl Into<Value>,
)
pub fn set_header_normalized( &mut self, key: impl Into<String>, value: impl Into<Value>, )
Set a header value with a normalized lowercase key.
Every ASCII case-insensitive duplicate is removed before the lowercase key is inserted.
Sourcepub fn remove_header(&mut self, key: &str) -> Option<Value>
pub fn remove_header(&mut self, key: &str) -> Option<Value>
Remove a header, matching case-insensitively.
Every entry whose key equals key ASCII case-insensitively is removed.
Returns the exact-case entry’s value when that entry existed, and
None otherwise — including when only case variants were removed.