Skip to content
CommunicationDocs 1.3.x

Remote Resolvers ​

Orders knows what Inventory can do from its contract. A resolver answers a different question: how do I reach Inventory when it is not mounted here? It maps the service's protobuf identity to a remote transport.

Watch one call ​

Keep the Orders handler unchanged. Switch where Inventory runs to see which route the server uses.

Where does Inventory live?
Orders calls InventorySame call in every scene
ts
const stock = await ctx.call(
  'shop.v1.InventoryService/CheckStock',
  create(CheckStockRequestSchema, { sku: req.sku }),
);
Inventory runs here: no network call.
ResponseInventory → Orders
{ units: 7 }

7 units of A-1 are in stock.

Illustration, not a live RPC. Run the complete example linked below to make the real call.

How is this call routed?

Two services. One process. Orders and Inventory are mounted on the same server. The catalog call reaches Inventory in-process; no socket or resolver lookup is needed.

  1. Look up InventoryService/CheckStock in the catalog.
  2. Find Inventory mounted on this server.
  3. Call the Inventory handler in-process and return its stock message.
createServer({
  services: [orders, inventory],
  catalog: serviceCatalog,
  remoteResolver: mapResolver({
    [InventoryService.typeName]: inventoryTransport,
  }),
});

inventoryTransport is a configured gRPC transport to the other process. A local target takes priority even when a remote route exists.

Read the scenes without animation
SceneWhere Inventory is mountedWhat the call does
TogetherOn the Orders serverCalls the handler in-process. The resolver is not consulted.
SeparateOn another server, with a configured routeUses the resolver's gRPC transport.
No routeNot on the Orders server; resolver returns nullRejects with Code.Unavailable, without calling Inventory.

Choose a routing rule ​

  • Explicit addresses: mapResolver maps each known service to a transport.
  • One upstream: singleTransportResolver sends remote services to one destination.
  • A naming convention: dnsResolver builds URLs from a DNS-style template.
  • Deployment configuration: perServiceEnvResolver reads service URLs from environment variables.

A resolver creates a route, not a health check. It is synchronous and does not perform network discovery itself. Successful routes are cached; a failed RPC does not automatically refresh the route or retry the call.

Go deeper ​

Find a section from the full guide

The detailed material is preserved on a separate page. Earlier section links still work here.