Skip to main content

StepAccumulator

Trait StepAccumulator 

Source
pub trait StepAccumulator: Sized {
    // Required method
    fn steps_mut(&mut self) -> &mut Vec<BuilderStep>;

    // Provided methods
    fn to(self, endpoint: impl Into<String>) -> Self { ... }
    fn process<F, Fut>(self, f: F) -> Self
       where F: Fn(Exchange) -> Fut + Send + Sync + 'static,
             Fut: Future<Output = Result<Exchange, CamelError>> + Send + 'static { ... }
    fn process_fn(self, processor: BoxProcessor) -> Self { ... }
    fn set_header(self, key: impl Into<String>, value: impl Into<Value>) -> Self { ... }
    fn map_body<F>(self, mapper: F) -> Self
       where F: Fn(Body) -> Body + Clone + Send + Sync + 'static { ... }
    fn set_body<B>(self, body: B) -> Self
       where B: Into<Body> + Clone + Send + Sync + 'static { ... }
    fn set_body_fn<F>(self, expr: F) -> Self
       where F: Fn(&Exchange) -> Body + Clone + Send + Sync + 'static { ... }
    fn set_header_fn<F>(self, key: impl Into<String>, expr: F) -> Self
       where F: Fn(&Exchange) -> Value + Clone + Send + Sync + 'static { ... }
    fn aggregate(self, config: AggregatorConfig) -> Self { ... }
    fn stop(self) -> Self { ... }
    fn log(self, message: impl Into<String>, level: LogLevel) -> Self { ... }
}
Expand description

Shared step-accumulation methods for all builder types.

Implementors provide steps_mut() and get step-adding methods for free. filter() and other branching methods are NOT included — they return different types per builder and stay as per-builder methods.

Required Methods§

Source

fn steps_mut(&mut self) -> &mut Vec<BuilderStep>

Provided Methods§

Source

fn to(self, endpoint: impl Into<String>) -> Self

Source

fn process<F, Fut>(self, f: F) -> Self
where F: Fn(Exchange) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<Exchange, CamelError>> + Send + 'static,

Source

fn process_fn(self, processor: BoxProcessor) -> Self

Source

fn set_header(self, key: impl Into<String>, value: impl Into<Value>) -> Self

Source

fn map_body<F>(self, mapper: F) -> Self
where F: Fn(Body) -> Body + Clone + Send + Sync + 'static,

Source

fn set_body<B>(self, body: B) -> Self
where B: Into<Body> + Clone + Send + Sync + 'static,

Source

fn set_body_fn<F>(self, expr: F) -> Self
where F: Fn(&Exchange) -> Body + Clone + Send + Sync + 'static,

Source

fn set_header_fn<F>(self, key: impl Into<String>, expr: F) -> Self
where F: Fn(&Exchange) -> Value + Clone + Send + Sync + 'static,

Source

fn aggregate(self, config: AggregatorConfig) -> Self

Source

fn stop(self) -> Self

Stop processing this exchange immediately. No further steps in the current pipeline will run.

Can be used at any point in the route: directly on RouteBuilder, inside .filter(), inside .split(), etc.

Source

fn log(self, message: impl Into<String>, level: LogLevel) -> Self

Log a message at the specified level.

The message will be logged when an exchange passes through this step.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§