Path: redb-route/redb.Route/Abstractions/ILoadBalancerStrategy.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/ILoadBalancerStrategy.cs
----
using System;
using System.Collections.Generic;
namespace redb.Route.Abstractions;
///
/// Strategy for selecting a target URI from a list of candidates.
/// Implementations must be thread-safe for concurrent pipeline usage.
///
public interface ILoadBalancerStrategy
{
///
/// Selects the next target URI based on strategy logic.
///
/// Current exchange (for sticky/content-based routing).
/// Available endpoint URIs.
/// Selected URI.
string Select(IExchange exchange, IReadOnlyList endpoints);
///
/// Reports that a selected endpoint has failed.
/// Used by failover strategies to track unhealthy endpoints.
/// Default implementation is a no-op.
///
/// The failed endpoint URI.
/// The exception that occurred.
void ReportFailure(string endpoint, Exception exception) { }
///
/// Reports that a selected endpoint succeeded.
/// Used by failover strategies to mark endpoints as healthy again.
/// Default implementation is a no-op.
///
/// The successful endpoint URI.
void ReportSuccess(string endpoint) { }
}