pub struct RouteBuilder { /* private fields */ }Expand description
Implementations§
Source§impl RouteBuilder
impl RouteBuilder
Sourcepub fn filter<F>(self, predicate: F) -> FilterBuilder
pub fn filter<F>(self, predicate: F) -> FilterBuilder
Open a filter scope. Only exchanges matching predicate will be processed
by the steps inside the scope. Non-matching exchanges skip the scope entirely
and continue to steps after .end_filter().
Sourcepub fn choice(self) -> ChoiceBuilder
pub fn choice(self) -> ChoiceBuilder
Open a choice scope for content-based routing.
Within the choice, you can define multiple .when() clauses and an
optional .otherwise() clause. The first matching when predicate
determines which sub-pipeline executes.
Sourcepub fn wire_tap(self, endpoint: &str) -> Self
pub fn wire_tap(self, endpoint: &str) -> Self
Add a WireTap step that sends a clone of the exchange to the given endpoint URI (fire-and-forget). The original exchange continues downstream unchanged.
Sourcepub fn error_handler(self, config: ErrorHandlerConfig) -> Self
pub fn error_handler(self, config: ErrorHandlerConfig) -> Self
Set a per-route error handler. Overrides the global error handler on CamelContext.
Sourcepub fn circuit_breaker(self, config: CircuitBreakerConfig) -> Self
pub fn circuit_breaker(self, config: CircuitBreakerConfig) -> Self
Set a circuit breaker for this route.
Sourcepub fn concurrent(self, max: usize) -> Self
pub fn concurrent(self, max: usize) -> Self
Override the consumer’s default concurrency model.
When set, the pipeline spawns a task per exchange, processing them
concurrently. max limits the number of simultaneously active
pipeline executions (0 = unbounded, channel buffer is backpressure).
§Example
RouteBuilder::from("http://0.0.0.0:8080/api")
.concurrent(16) // max 16 in-flight pipeline executions
.process(handle_request)
.build()Sourcepub fn sequential(self) -> Self
pub fn sequential(self) -> Self
Force sequential processing, overriding a concurrent-capable consumer.
Useful for HTTP routes that mutate shared state and need ordering guarantees.
Sourcepub fn route_id(self, id: impl Into<String>) -> Self
pub fn route_id(self, id: impl Into<String>) -> Self
Set the route ID for this route.
If not set, the route will be assigned an auto-generated ID.
Sourcepub fn auto_startup(self, auto: bool) -> Self
pub fn auto_startup(self, auto: bool) -> Self
Set whether this route should automatically start when the context starts.
Default is true.
Sourcepub fn startup_order(self, order: i32) -> Self
pub fn startup_order(self, order: i32) -> Self
Set the startup order for this route.
Routes with lower values start first. Default is 1000.
Sourcepub fn split(self, config: SplitterConfig) -> SplitBuilder
pub fn split(self, config: SplitterConfig) -> SplitBuilder
Begin a Splitter sub-pipeline. Steps added after this call (until
.end_split()) will be executed per-fragment.
Returns a SplitBuilder — you cannot call .build() until
.end_split() closes the split scope (enforced by the type system).
Sourcepub fn multicast(self) -> MulticastBuilder
pub fn multicast(self) -> MulticastBuilder
Begin a Multicast sub-pipeline. Steps added after this call (until
.end_multicast()) will each receive a copy of the exchange.
Returns a MulticastBuilder — you cannot call .build() until
.end_multicast() closes the multicast scope (enforced by the type system).
Sourcepub fn build(self) -> Result<RouteDefinition, CamelError>
pub fn build(self) -> Result<RouteDefinition, CamelError>
Consume the builder and produce a RouteDefinition.