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
apiHoststringAPI Gateway gRPC host (e.g., "localhost").
apiPortintAPI Gateway gRPC port (e.g., 5002).
responseEventTypestringCloudEvent type for response events.
sourceUriURI 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
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
inputCloudEventpayloadJsonNodeapiApiClient
Returns
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
inputCloudEventpayloadJsonNode