pub trait StepAccumulator: Sized {
Show 14 methods
// 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 { ... }
fn convert_body_to(self, target: BodyType) -> Self { ... }
fn script(
self,
language: impl Into<String>,
script: impl Into<String>,
) -> 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§
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
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
fn set_body<B>(self, body: B) -> Self
fn set_body_fn<F>(self, expr: F) -> Self
fn set_header_fn<F>(self, key: impl Into<String>, expr: F) -> Self
fn aggregate(self, config: AggregatorConfig) -> Self
Sourcefn stop(self) -> Self
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.
Sourcefn log(self, message: impl Into<String>, level: LogLevel) -> Self
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.
Sourcefn convert_body_to(self, target: BodyType) -> Self
fn convert_body_to(self, target: BodyType) -> Self
Sourcefn script(self, language: impl Into<String>, script: impl Into<String>) -> Self
fn script(self, language: impl Into<String>, script: impl Into<String>) -> Self
Execute a script that can modify the exchange (headers, properties, body).
The script has access to headers, properties, and body variables
and can modify them with assignment syntax: headers["k"] = v.
§Example
// ignore: requires full CamelContext setup with registered language
route.script("rhai", r#"headers["tenant"] = "acme"; body = body + "_processed""#)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.