Skip to main content

HeadersExtractor

Trait HeadersExtractor 

Source
pub trait HeadersExtractor: Send + Sync {
    // Required method
    fn extract(&self, message: &dyn Any) -> Headers;
}
Expand description

Extracts correlation Headers from a captured message at the dispatch boundary.

The encoder boundary deliberately omits headers (EncodedPayload documents this), so the bus tap consults the registry-registered extractor instead. Registration without an explicit extractor falls back to Headers::empty; that keeps capture working for allow-list types whose underlying struct has not yet grown correlation_id / causation_id fields (header propagation lands incrementally per the SPEC).

Required Methods§

Source

fn extract(&self, message: &dyn Any) -> Headers

Returns the headers carried by message. Implementations downcast to the concrete type they were registered for and read the relevant fields; mismatched types yield Headers::empty so a stale registration cannot crash the tap.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: 'static, F> HeadersExtractor for TypedHeadersExtractor<T, F>
where F: Fn(&T) -> Headers + Send + Sync,