Skip to main content

MessageInterceptor

Trait MessageInterceptor 

Source
pub trait MessageInterceptor: Send + Sync {
    // Provided methods
    fn before_handle(&self, meta: &Metadata) -> SpanGuard { ... }
    fn outgoing(&self, parent: &Metadata) -> Metadata { ... }
}
Expand description

A Props-level hook that observes message handling for cross-cutting concerns such as distributed tracing. Default methods are no-ops, so an interceptor only overrides what it needs.

The default [TraceContextInterceptor]-style behaviour (linking parent → child spans) is provided by atomr-telemetry (FR-11); core only defines the hook so domain message types stay clean.

Provided Methods§

Source

fn before_handle(&self, meta: &Metadata) -> SpanGuard

Called immediately before Actor::handle with the incoming message’s metadata. The returned SpanGuard is dropped once handling completes.

Source

fn outgoing(&self, parent: &Metadata) -> Metadata

Derive the metadata to attach to messages sent while handling the current message. Defaults to propagating the parent context unchanged.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§