Path: redb-route/redb.Route/Abstractions/ILoadBalancerDefinition.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route/Abstractions/ILoadBalancerDefinition.cs
----
using System;
namespace redb.Route.Abstractions;
///
/// Fluent builder for configuring a Load Balancer step.
/// Allows setting endpoints and strategy via explicit instance or shortcut methods.
///
public interface ILoadBalancerDefinition
{
/// Sets the target endpoint URIs to balance across.
/// One or more endpoint URIs.
ILoadBalancerDefinition Endpoints(params string[] uris);
/// Sets a custom load balancer strategy.
/// The strategy instance.
ILoadBalancerDefinition Strategy(ILoadBalancerStrategy strategy);
/// Uses round-robin strategy (default).
ILoadBalancerDefinition UseRoundRobin();
/// Uses random strategy.
ILoadBalancerDefinition UseRandom();
/// Uses failover strategy (tries next endpoint on failure).
ILoadBalancerDefinition UseFailover();
/// Uses sticky strategy with the specified correlation key extractor.
/// Function extracting a correlation key from the exchange.
ILoadBalancerDefinition UseSticky(Func correlationKeyExtractor);
/// Uses weighted strategy with the specified endpoint weights.
/// Dictionary mapping endpoint URI to relative weight.
ILoadBalancerDefinition UseWeighted(System.Collections.Generic.Dictionary weights);
}