pub struct LoadBalancerBuilder { /* private fields */ }Expand description
Builder for the sub-pipeline within a .load_balance() … .end_load_balance() block.
Exposes the same step methods as RouteBuilder (to, process, filter, etc.)
but NOT .build() and NOT .load_balance() (no nested load balancers).
Calling .end_load_balance() packages the sub-steps into a BuilderStep::LoadBalance
and returns the parent RouteBuilder.
Implementations§
Source§impl LoadBalancerBuilder
impl LoadBalancerBuilder
Sourcepub fn round_robin(self) -> Self
pub fn round_robin(self) -> Self
Set the load balance strategy to round-robin (default).
Sourcepub fn weighted(self, weights: Vec<(String, u32)>) -> Self
pub fn weighted(self, weights: Vec<(String, u32)>) -> Self
Set the load balance strategy to weighted selection.
Each endpoint is assigned a weight that determines its probability of being selected.
Sourcepub fn failover(self) -> Self
pub fn failover(self) -> Self
Set the load balance strategy to failover.
Exchanges are sent to the first endpoint; on failure, the next endpoint is tried.
Sourcepub fn end_load_balance(self) -> RouteBuilder
pub fn end_load_balance(self) -> RouteBuilder
Close the load balance scope. Packages the accumulated sub-steps into a
BuilderStep::LoadBalance and returns the parent RouteBuilder.
Trait Implementations§
Source§impl StepAccumulator for LoadBalancerBuilder
impl StepAccumulator for LoadBalancerBuilder
fn steps_mut(&mut self) -> &mut Vec<BuilderStep>
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
Source§fn stop(self) -> Self
fn stop(self) -> Self
fn delay(self, duration: Duration) -> Self
fn delay_with_header( self, duration: Duration, header: impl Into<String>, ) -> Self
Source§fn log(self, message: impl Into<String>, level: LogLevel) -> Self
fn log(self, message: impl Into<String>, level: LogLevel) -> Self
Source§fn convert_body_to(self, target: BodyType) -> Self
fn convert_body_to(self, target: BodyType) -> Self
fn stream_cache(self, threshold: usize) -> Self
Source§fn stream_cache_default(self) -> Self
fn stream_cache_default(self) -> Self
Source§fn marshal(self, format: impl Into<String>) -> Result<Self, CamelError>
fn marshal(self, format: impl Into<String>) -> Result<Self, CamelError>
Source§fn unmarshal(self, format: impl Into<String>) -> Result<Self, CamelError>
fn unmarshal(self, format: impl Into<String>) -> Result<Self, CamelError>
Source§fn validate(self, expression: impl Into<String>) -> Self
fn validate(self, expression: impl Into<String>) -> Self
Source§fn script(self, language: impl Into<String>, script: impl Into<String>) -> Self
fn script(self, language: impl Into<String>, script: impl Into<String>) -> Self
Source§fn enrich(self, uri: impl Into<String>) -> Self
fn enrich(self, uri: impl Into<String>) -> Self
Source§fn poll_enrich(self, uri: impl Into<String>, timeout_ms: u64) -> Self
fn poll_enrich(self, uri: impl Into<String>, timeout_ms: u64) -> Self
fn bean(self, name: impl Into<String>, method: impl Into<String>) -> Self
Source§fn to_layered(
self,
uri: impl Into<String>,
layer: impl ProcessorLayer + 'static,
) -> Self
fn to_layered( self, uri: impl Into<String>, layer: impl ProcessorLayer + 'static, ) -> Self
uri through a Tower middleware layer. Read more