Table of Contents

Class ApiWorker

Namespace
Virtufin.Worker.DevKit
Assembly
Virtufin.Worker.DevKit.dll

Base class for JSON workers that need a pre-configured Virtufin.Api.Client.ApiClient. The base class (WorkerBase<TInput, TOutput>) handles codec decode and envelope construction; this class wires the Api client and passes it to the subclass.

public abstract class ApiWorker : WorkerBase<JsonNode, JsonObject>, IWorker
Inheritance
ApiWorker
Implements
IWorker
Inherited Members

Constructors

ApiWorker(string, int, string, Uri)

Initializes a new ApiWorker with a fixed API Gateway host and port.

protected ApiWorker(string apiHost, int apiPort, string responseEventType, Uri source)

Parameters

apiHost string

API Gateway gRPC host (e.g., "localhost").

apiPort int

API Gateway gRPC port (e.g., 5002).

responseEventType string

CloudEvent type for response events.

source Uri

URI identifying this worker as the event source.

ApiWorker(string, string, int)

An API worker of type workerType, named by the naming library (see WorkerTypeNames).

protected ApiWorker(string workerType, string apiHost, int apiPort)

Parameters

workerType string
apiHost string
apiPort int

Fields

Api

The API client for invoking backend services via the API Gateway.

protected readonly ApiClient Api

Field Value

ApiClient

Methods

HandleAsync(CloudEvent, JsonNode, ApiClient)

Subclasses override this with worker logic that uses the pre-configured Api.

protected abstract Task<JsonObject?> HandleAsync(CloudEvent input, JsonNode payload, ApiClient api)

Parameters

input CloudEvent
payload JsonNode
api ApiClient

Returns

Task<JsonObject>

ProcessAsync(CloudEvent, JsonNode)

Sealed delegation to the typed override. Subclasses override the 3-arg form below to receive the pre-configured Api.

protected override sealed Task<JsonObject?> ProcessAsync(CloudEvent input, JsonNode payload)

Parameters

input CloudEvent
payload JsonNode

Returns

Task<JsonObject>