Namespace Virtufin.Api.Client
Classes
- ApiClient
Client for the Virtufin API Gateway: dynamic per-service RPC dispatch (service names as dynamic members, e.g.
client.workmanager.SomeMethod()), plus direct methods for state, pub/sub, triggers and config.
- ApiEndpoint
Configuration constants for the gateway's gRPC endpoint that other services call. The endpoint is configured via HostEnvVar and PortEnvVar, with defaults suitable for local development.
- ApiKeyClientInterceptor
Client-side gRPC interceptor that attaches
x-api-keyto every outbound call on the channel it is applied to. Pairs with the gateway's server-sideApiKeyInterceptor, which rejects every non-health-check call once at least one key is configured on it.
- CloudEventFactory
Builds the protobuf CloudEvents that
Pubsub.PublishEventtakes.
- CloudEvents
CloudEvents v1.0 values this codebase writes.
- GatewayInvokeException
A backend failure the gateway reported in-band on
Gateway.Invoke: the gRPC call itself succeeded, the response carriedsuccess = falsewith the backend's status code name and message.
- InstanceIdProvider
The pod name (
HOSTNAME) when it is set and non-empty, otherwise a random GUID fixed for the life of the process.
- ServiceClient
Dynamic client for invoking methods on a specific service through the gateway. Allows syntax like:
client.workmanager.SomeMethod().RPC method names are accessed as dynamic members. Each member returns a
Func<Dictionary, Task<Dictionary>>that invokes the method via the Gateway's InvokeJson RPC.ServiceClient instances are created by TryGetMember(GetMemberBinder, out object?) (i.e.
client.workmanager) and cached per service name.
- ServiceCollectionExtensions
Registers the gateway's typed gRPC clients for a service that calls it.
- Subscription
A live pub/sub subscription from SubscribeAsync(IEnumerable<string>, CancellationToken): enumerate it once with
await foreachfor the events, in arrival order; dispose it to end the subscription. A stream failure or cancellation is thrown from the enumeration.
Interfaces
- IGatewayApi
The gateway itself: service discovery and typed dispatch to a backend service.
- IInstanceIdProvider
Identifies this process among a service's replicas.
- IPubsubApi
The gateway's Pubsub service: publish CloudEvents to topics and subscribe to them.
- IStateApi
The gateway's State service: per-service key/value state with etags. A missing key is a RpcException with
NotFound; a lost compare-and-swap (anetagorcreateOnlywrite) isAborted; etag"0"is rejected withInvalidArgument.
- ITriggerApi
The gateway's Trigger service: scheduled publications to a topic.
- IVirtufinApi
Everything a worker or a client program uses the Virtufin API for. Implemented by ApiClient over the gateway, and by in-process hosts (the worker devkit's local WorkManager) over an in-memory bus and state store, so the same worker runs in both places.