RouteProvider trait is extended with fn n_routes(), which generates up to n different routing urls:
pub trait RouteProvider: std::fmt::Debug + Send + Sync {
/// Generates the next routing URL based on the internal routing logic.
///
/// This method returns a single `Url` that can be used for routing.
/// The logic behind determining the next URL can vary depending on the implementation
fn route(&self) -> Result<Url, AgentError>;
/// Generates up to `n` different routing URLs in order of priority.
///
/// This method returns a vector of `Url` instances, each representing a routing
/// endpoint. The URLs are ordered by priority, with the most preferred route
/// appearing first. The returned vector can contain fewer than `n` URLs if
/// fewer are available.
fn n_ordered_routes(&self, n: usize) -> Result<Vec<Url>, AgentError>;
}
This newly introduced method should facilitate retry logic, in case routing url is unhealthy.
Calling the fn route() for retries was (and still is) possible. However, implementations do not provide guarantees that urls returned in sequential invocations are unique. Function fn n_routes() comes at rescue and returns up to n unique routing urls, which are also ordered by priority.
Description
RouteProvider trait
is extended withfn n_routes()
, which generates up ton
different routing urls:This newly introduced method should facilitate retry logic, in case routing url is unhealthy. Calling the
fn route()
for retries was (and still is) possible. However, implementations do not provide guarantees that urls returned in sequential invocations are unique. Functionfn n_routes()
comes at rescue and returns up ton
unique routing urls, which are also ordered by priority.How Has This Been Tested?
Additional tests have been added.
Checklist: