Namespace Virtufin.Api.Services
Classes
- AggregatedReflectionResolver
Resolves gRPC server reflection requests against two descriptor sources: the gateway's own compiled-in protos (Gateway/Config/State/Pubsub) and the backend descriptor caches maintained by GrpcReflectionService. This is what lets clients reflect on backend services (virtufin.WorkManager, ...) through the gateway, which does not compile their protos in. Besides fully-qualified symbols, the registered service name from services.json (e.g. "workmanager") is accepted as a FileContainingSymbol alias for the backend's whole descriptor set.
- AggregatedReflectionService
grpc.reflection.v1alpha.ServerReflection endpoint backed by AggregatedReflectionResolver. The Python client and the TUI speak this version.
- AggregatedReflectionV1Service
grpc.reflection.v1.ServerReflection endpoint backed by AggregatedReflectionResolver. Modern tooling (grpcurl) and the gateway's own backend-facing client speak this version.
- ApiEventPayloads
The gateway's own event payloads as their messages (openspec pubsub-topics, Platform Event Payloads;
api_events.proto): a CloudEvent carrying a message with its content type and dataschema, and the schemas the gateway registers in its own registry at start, so every client decodes the events like any registered payload.
- ApiEventSchemaRegistration
Registers the gateway's own event payloads (All) in its payload schema registry when it starts, as every producer does (openspec api-gateway, Payload Schema Registry), so clients decode the state, trigger and topic catalog events through it. In the background: it never delays the gateway's start. The registry's store goes through the Dapr sidecar, which usually accepts connections only after the gateway has started, so a failed registration is retried every RetryDelay until all of them are registered.
- ApiNames
The gateway's own names, from its
virtufin.service.apinaming fragment (embedded;naming/virtufin.service.api.yaml). The gateway names only what it publishes itself: it never parses or validates callers' topics or keys.
- AppMetrics
Application-level metrics for the API gateway.
- CloudEventAttributeException
A CloudEvent attribute that cannot be converted (e.g. a
timestring that is not RFC3339). Callers map it to an invalid-argument error naming Attribute -- it is bad input, not a server fault.
- ConfigService
Implementation of the gRPC Config service. Provides service configuration discovery and management capabilities.
- ConsumerProgress
Consumers' positions on topics, as reported through
Pubsub.ReportProgresson any gateway pod (shared over ConsumerProgressListener), and the wait of a paced publish on them. In memory: a pod that starts knows every live consumer within one report interval.
- ConsumerProgressListener
Keeps this pod's ConsumerProgress current: subscribes to the gateway's progress topic (
sys.api.pubsub.progress.reported), on which every pod publishes the positions reported to it (Pubsub.ReportProgress). Each pod has its own Dapr consumer group, so every pod sees every report.
- DaprPayloadSchemaBlobStore
IPayloadSchemaBlobStore over the Dapr state API's byte calls.
- DaprPublicationCapabilityGate
Requires the publication state store to report the Dapr ETAG and TRANSACTIONAL capabilities (the same ones an actor state store needs). Reads the sidecar's metadata once it is reachable and caches the verdict.
- DaprPublicationStateStore
IPublicationStateStore over the Dapr state API.
- DaprPublish
How the gateway puts a CloudEvent on a Dapr topic: as a raw payload, so the stream holds the protobuf CloudEvent exactly as encoded (ToStreamBytes(CloudEvent)) and subscriptions read it back verbatim.
- DaprStableAppCallbackMethodProvider
Serves the parts of Dapr's stable
AppCallbackservice that the runtime actually calls:OnJobEvent(scheduled job delivery) andListTopicSubscriptions(declarative-subscription discovery).Why this exists: the Dapr runtime (confirmed on 1.18.1) delivers scheduled jobs to
AppCallback/OnJobEvent— the stable service, per dapr/dapr's ownappcallback.proto. The .NET SDK lags it: the generated code inDapr.Protos1.18.2 containsOnJobEventAlpha1onAppCallbackAlphaand noOnJobEventanywhere, so DaprAppCallbackService could only ever bind the alpha route. Nothing served the route Dapr actually calls, the request matched no endpoint, and it was rejected 401 byApiKeyHttpMiddleware(which exempts only requests whose matched endpoint carriesGrpcMethodMetadata). Net effect: **no scheduled trigger ever fired**, while Dapr retried roughly once a second forever.Registering the method here rather than regenerating
appcallback.protointo this repo is deliberate: the request and response types already exist inDapr.Protosand are reused as-is, so there is no second copy of the Dapr message types to collide with the SDK's (the CS0433 duplicate-type trap this codebase has hit before). Only the service/method *name* differs.Because the endpoint is produced through the normal gRPC service-model pipeline it carries
GrpcMethodMetadata, soApiKeyHttpMiddlewarelets it through toApiKeyInterceptor, which exempts the/dapr.proto.runtime.v1.AppCallback/prefix — the sidecar cannot present an API key.Both routes stay live: the alpha one for older runtimes, this one for current ones. They share a single handler, so behavior cannot drift. Once the SDK generates the stable method, this provider can be replaced by a plain
override OnJobEventon DaprAppCallbackService.
- DescriptorSymbols
The fully-qualified symbols a proto file defines, as gRPC server reflection's
file_containing_symbolresolves them (any symbol protobuf's descriptor pool finds by name, which is whatgrpcurl describesends): services, methods, messages (nested ones too), fields, oneofs, extensions, enums and enum values.
- ErrorInfoInterceptor
Every failure of the gateway's own services carries a
google.rpc.ErrorInfo(openspec write-results, Failures Are gRPC Statuses With Details). A handler that names its failure precisely throws Failure(StatusCode, string, string, string?, string?, params IMessage[]); this interceptor gives every other RpcException the reason its status code implies (ForStatus(StatusCode)), and turns an unexpected exception intoINTERNAL(Internal) with Virtufin.Api.Services.SafeError.InternalError, logged here, so no internal detail crosses the boundary and no path answers without details. Registered first, so the authentication interceptor's refusals get one too.
- FenceRecord
A connection's fence: which activation may publish, and until when it must renew.
- FencedPublicationKeys
The per-connection keys of the publication fence. Default comes from the naming registry; tests use an isolated ForPrefix(string).
- FencedPublicationStore
The publication fence on any Dapr state store with ETags (and the TRANSACTIONAL capability the guarded writes use). Every change is one ETag-guarded write of a single key, the one thing all such stores make atomic.
Heartbeat fencing: publishers do not pass the fence per frame. The holder renews its lease every second or so; a superseded holder learns it from a rejected renewal and stops, so a stale owner publishes for at most one renewal interval after its successor claims. Times are this replica's UTC clock, as for WorkManager's recovery lease.
- FencedPublicationSweeper
Removes abandoned publication fences (inactive or expired for two leases), walking the fence index; nothing here depends on the state store's provider.
- FieldSchema
Describes a single field within a message schema.
- ForwardedHeaders
The allow-list of request headers the gateway propagates to a backend on a proxied call, and the filters that apply it.
- GatewayService
Implementation of the gRPC Gateway service: service discovery and method invocation. Subscribing is
Pubsub.Subscribe(see PubsubService).
- GroupSnapshot
A consumer group's position on a stream: the last id read by it, and the ids up to that one still pending, oldest first. PendingComplete is false when more were pending than asked for.
- GrpcCallResult
Represents the result of a gRPC call invocation.
- GrpcCallStatusCodes
The status vocabulary
Gateway.Invoke/InvokeJsonreport inInvokeResponse.status.Every status the gateway emits MUST come from here, so one condition yields one string whether the gateway or the backend detected it. Translate a downstream RpcException with
GrpcStatusCodeMap.ToGatewayStatus.
- GrpcReflectionService
Provides gRPC reflection functionality including service discovery, method schema retrieval, and dynamic gRPC invocation based on reflection data.
- GrpcStatusCodeMap
Translates StatusCode into the gateway's own GrpcCallStatusCodes vocabulary, so one condition yields one string regardless of whether the gateway or the backend produced it.
- InvalidPayloadSchemaException
A schema a producer may not register, with the reason.
- JetStreamConsumerGroupPositioner
IConsumerGroupPositioner for Dapr's
pubsub.jetstream, over a NATS connection of its own to the component's server (workmanager#132). It reads the topic's stream so that a subscriber that is behind is served from it (TopicDaprSubscriptionRegistry) andreplay_sinceworks, as on Redis. It moves nothing: where a new subscription starts is the component'sdeliverPolicy(new: at the stream's tail).
- JetStreamIds
JetStream stream sequences as stream ids: the sequence in decimal, 0 as Start.
- JetStreamPositionerOptions
Settings of the JetStreamConsumerGroupPositioner. The defaults suit a NATS in the same cluster; nothing needs configuring.
- MethodKinds
Whether a method reads or writes (openspec api-gateway, Method Kinds): the descriptor decides when it marks the method
NO_SIDE_EFFECTS, the standard health service's calls read (its protocol defines them as checks without effect, but its proto carries no option), else the name rule. The gateway is the only place this rule is kept; clients take the kind fromListMethods.
- MethodSchema
Describes the schema of a gRPC method's input or output type.
- NoopConsumerGroupPositioner
No-op positioner: for pub/sub backends without one, or a Redis or JetStream backend without access configured (local dev).
- OneofCaseSchema
Represents a case within a oneof field group.
- PayloadSchemaCatalogEntry
One registered content type in the catalog record.
- PayloadSchemaRegistry
The payload schema registry (openspec api-gateway, Payload Schema Registry): a producer registers the schema of every binary payload it emits, and generic readers look a schema up by content type or hash.
- ProviderSelectingConsumerGroupPositioner
Picks the positioner for the pub/sub backend actually loaded, by the Dapr component's type, the first time it is needed (the sidecar is up by then).
pubsub.redisandpubsub.jetstreamhave one; other backends start subscriptions as their component configures (e.g. KafkainitialOffset: newest) and cannot serve a subscriber that is behind.
- PubsubBatchOptions
Limits of a batch entry (configuration
PubsubBatchEntryMaxEvents,PubsubBatchEntryMaxBytes): how many of one topic's events of aPublishEventscall are stored as one stream entry, and how large that entry may get. Each stream entry costs one sidecar round trip (some milliseconds) whatever it holds, so the events per entry are what bounds a publisher's throughput. The byte limit keeps an entry below the smallest message limit of the supported backends (NATS JetStream: 1 MiB by default).
- PubsubDeliveryOptions
How the gateway serves a subscriber that is behind (TopicDaprSubscriptionRegistry). Delivery never waits for it and never drops its events: it is served from the topic's stream at its own pace and rejoins live delivery when it has caught up.
- PubsubPaceOptions
Settings of paced publishing (openspec paced-publishing). The defaults fit the chart's
streamTTLof one minute; a deployment with another retention sets them from it.
- PubsubReplayOptions
Bounds of a
replay_sinceSubscribe (configurationPubsubReplayMaxEntries,PubsubReplayMaxBytes): a replay of more retained entries, or more payload bytes, is refused withOUT_OF_RANGEbefore anything is sent. The entries are held in memory while they are sent, so the byte bound protects the gateway from a replay of large events (an order-book image is ~127 KB).
- PubsubService
Implements the Pubsub gRPC service for publish/subscribe messaging via Dapr. Publish stores a CloudEvent as protobuf; Subscribe streams the stored CloudEvents, or whole batches of them to a caller that asked for it.
- PubsubSubscriptionOptions
How long a topic's Dapr subscription stays open after its last subscriber left (configuration
PubsubSubscriptionLingerSeconds, default DefaultLingerSeconds, 0 closes at once). A subscriber that joins meanwhile reuses it, so a quick resubscribe never closes and reopens a Dapr subscription: a closed one leaves daprd's reader behind to take the topic's next message (common#28). Messages published while nobody is subscribed are acked and dropped, as with no subscription at all (no catch-up).
- RedisConsumerGroupPositioner
IConsumerGroupPositioner over a direct Redis connection to the pub/sub component's Redis. Safe only because the group is this pod's alone (
{podName}) and the registry calls it while this process holds no Dapr subscription for the topic.
- ReflectionAnswer
Protocol-neutral result of a reflection lookup; adapted into the v1alpha/v1 response messages by the two service endpoints below. Exactly one of ServiceNames, FileDescriptorProtos, or ErrorMessage is set.
- RetainedEntry
One retained stream entry: its stream id and the payload as stored (what a raw-payload Dapr subscription delivers).
- ServiceMethodInfo
Represents a gRPC method with its metadata.
- SidecarReaderSweeper
Debounced UnblockSidecarReadersAsync(CancellationToken) after Dapr subscriptions close, so a closed subscription's parked reader exits before it takes a message (see the positioner's remarks).
- StateChangeEvents
CloudEvent attributes for the Tier 0 state-change topics (
sys.api.state.saved,sys.api.state.deleted).
- StoredItem
One state entry as read: raw JSON (null when absent) and its ETag.
- StoredWrite
One write in a transaction: an upsert (Json set) or a delete, guarded by ETag when set.
- StreamIds
Redis stream ids (
ms-seq), ordered as the stream orders them.
- StreamPage
Stream entries read after an id (ReadAfterAsync(string, string, int, CancellationToken)), oldest first; AnchorPresent says whether the entry with that id was still in the stream.
- SubscriptionHealthSweeperHostedService
Periodically probes every subscriber with a heartbeat write and ends the calls of those that take nothing: a full channel that took no write for Stall belongs to a client that is gone or stuck (Virtufin.Api.Services.TopicDaprSubscriptionRegistry.SweepStalled()). A subscriber that is merely behind keeps taking writes and stays. A connection that closed ends its call by itself; this is for the ones that went silent.
- TopicCatalog
The topics seen at the gateway, for
Pubsub.ListTopics.Dapr's pubsub API cannot list topics, and asking the broker would tie this to one component (Redis stream keys, Kafka metadata, ...). Every publish and subscribe in Virtufin passes through the gateway, so the gateway records the names itself, in one state-store record (TopicCatalogKey) written with the ETag-guarded operations of IPublicationStateStore.
Note(string, TopicUse) is on the publish path, so it only touches memory: each replica notes a topic at most once per RecordInterval per use, and TopicCatalogWriter merges what is pending into the record in one write. Entries unseen for Retention are dropped then. Per-run reply topics (
rpc.<caller>.reply.<run_id>) are never recorded: each is used once, and they would bury the real topics.
- TopicCatalogEvents
Announces topics new to the catalog on
sys.api.topic.catalog.added(api#56), data theTopicCatalogAddedmessage. Best effort, as the state-change events: a failed publish is logged; a client that missed it reads the catalog again (Pubsub.ListTopics) when it resubscribes.
- TopicCatalogWriter
Flushes TopicCatalog every few seconds.
- TopicDaprSubscriptionRegistry
The gateway's in-process fan-out broker: one Dapr subscription per topic per API process, shared by every
Pubsub.Subscribecall on that topic, each message written to every subscriber's buffer (Virtufin.Api.Services.SubscriberBuffer). A batch entry (Virtufin.Api.Services.PubsubBatchEntry) is written as its single events, in order, or, to a subscriber that asked for whole batches, as one response holding the stored bytes (openspec protobuf-event-path).
- TopicDaprSubscriptionRegistry.SubscriptionHandle
Per-caller handle. Disposing removes the caller's subscriber.
- TopicSighting
When a topic was last published or subscribed through the gateway; 0 = never.
- TriggerMetadata
A trigger's metadata (openspec groups-and-topology, design decision 2): what changes without rescheduling its Dapr job. Stored as JSON under TriggerMetadataKey(string).
- TriggerMetadataStore
The trigger metadata records, in the api's state store (IPublicationStateStore): read with their ETags, created only if absent, and replaced by compare-and-swap, so two membership changes on one trigger never lose each other (resource-groups, Atomic Membership Changes).
- TriggerService
The Trigger service (openspec item-identity, write-results, standard-tags Trigger Tags, resource-groups): a trigger is a Dapr job named by the trigger's id, whose data holds the target topic, plus a metadata record (TriggerMetadataStore) holding its tags, groups and owner, so those change without rescheduling the job. The record is written before the job is scheduled and deleted after the job;
ListTriggersjoins the two, so a record whose job is gone is never shown and a job without a record shows untagged and in no group.
- WorkManagerGroupCheck
IGroupExistenceCheck through the WorkManager, which keeps the groups (openspec groups-and-topology, design decision 2):
GetGroup{id}for each group, by the gateway's own route to its backends (GrpcReflectionService, asGateway.InvokeJson), so the api depends on no WorkManager type. A group that does not exist fails with GroupNotFound; one whose deletion has started (Group.deleting) takes no members, as the WorkManager refuses it too, and fails with Deleting. A WorkManager that does not answer is Unavailable: the group is not taken for granted.
Structs
- ConsumerProgress.Laggard
The consumer behind the most on a topic, if any lags at or over the high-water mark.
Interfaces
- IConsumerGroupPositioner
Moves this gateway pod's Redis consumer group for a topic to the stream's tail right before the gateway opens its Dapr subscription for that topic, so a new subscription only receives messages published after it opened.
- IGroupExistenceCheck
Whether the groups a trigger is put into exist (resource-groups, Membership in Several Groups: every named group SHALL exist). WorkManagerGroupCheck asks the WorkManager, which keeps the groups.
- IPayloadSchemaBlobStore
A schema's bytes, raw: opaque by nature, so not a JSON record (common#33, the state exception).
- IPublicationCapabilityGate
Whether fenced publication can run on the configured state store.
- IPublicationStateStore
The state operations fenced publication needs, and nothing provider specific: bulk read with ETags, create-if-absent, and an all-or-nothing transaction whose writes may be ETag-guarded. Any Dapr state store with the ETAG and TRANSACTIONAL capabilities provides them.
Enums
- TopicUse
How the gateway saw a topic.