Skip to content

Calling the gateway

The gateway speaks native gRPC on its gRPC port (5002) and gRPC-Web on its HTTP port (5001), for browsers. The HTTP port also answers the Kubernetes /health and /healthz probes; every business operation is a gRPC call.

Clients

Use the generated clients: C#, Python or TypeScript. They cover the gateway's own services (Gateway, Config, State, Pubsub, Trigger) and reach the backends registered with it, such as workmanager.

Backends known only by reflection

  • Gateway.ListServices names the registered backends and Gateway.GetMethodSchema returns a method's request and response schema.
  • Gateway.Invoke forwards a request as serialized protobuf bytes.
  • Gateway.InvokeJson takes and returns JSON strings inside the gRPC message; the gateway converts them to and from protobuf with the backend's reflected descriptors.
  • The gateway's gRPC server reflection serves its own descriptors merged with each backend's, so a reflection client sees virtufin.WorkManager next to virtufin.Gateway. FileContainingSymbol resolves every symbol kind, own or backend: services, methods, messages, fields, oneofs, enums and enum values. A registered name such as workmanager also resolves as an alias.

Command line and browser

# List and describe services through the gateway
grpcurl -plaintext localhost:5002 list
grpcurl -plaintext localhost:5002 describe virtufin.WorkManager
grpcurl -plaintext localhost:5002 describe virtufin.WorkManager.ListWorkers
grpcurl -plaintext localhost:5002 describe virtufin.ListWorkersRequest

# Invoke a backend method with JSON over gRPC
grpcurl -plaintext -d '{"service":"workmanager","method":"ListWorkers","request_data":"{}"}' \
  localhost:5002 virtufin.Gateway/InvokeJson

For a remote endpoint, drop -plaintext and pass the key with -H "x-api-key: $VIRTUFIN_API_KEY".

For an interactive explorer, run grpcui -plaintext localhost:5002 (or bash common/scripts/run_grpcui_local.sh localhost:5002; TLS=true for a remote TLS endpoint). Keep it loopback-only; see the gRPC API explorer guide.