YARP is designed around the reverse proxy pipeline, but I have a use case where I need to call downstream services directly from the backend.
Im working in a microservice orchestrator (BFF-style) architecture, where the backend aggregates JSON data (e.g., config, menus) from multiple services.
Ideally, Id like to reuse YARP’s cluster configuration and load balancing logic to resolve a destination and call it via HttpClient, something like:
var url = await yarpResolver.GetDestinationAsync(clusterId);
var result = await httpClient.GetAsync(url);
Question
Is there a way to resolve a cluster destination (including load balancing/health checks) outside the proxy pipeline?
If not, would it make sense to expose something like:
public interface IClusterAddressResolver
{
ValueTask<Uri> GetDestinationAsync(string clusterId, CancellationToken cancellationToken = default);
}
YARP is designed around the reverse proxy pipeline, but I have a use case where I need to call downstream services directly from the backend.
Im working in a microservice orchestrator (BFF-style) architecture, where the backend aggregates JSON data (e.g., config, menus) from multiple services.
Ideally, Id like to reuse YARP’s cluster configuration and load balancing logic to resolve a destination and call it via
HttpClient, something like:Question
Is there a way to resolve a cluster destination (including load balancing/health checks) outside the proxy pipeline?
If not, would it make sense to expose something like: