Skip to content

How to expose cluster address resolution for backend-to-backend calls? #3004

@gumbarros

Description

@gumbarros

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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions