Table of Contents

Class ApiLifecyclePublisher

Namespace
Virtufin.WorkManager.Services
Assembly
Virtufin.WorkManager.dll

Publishes worker lifecycle events to sys.workmanager.worker.lifecycle (ce-type com.virtufin.workmanager.worker.lifecycle, subject worker/<id>, the state in the payload's state field; names from Virtufin.WorkManager.Engines.WorkManagerNames). Events are CloudEvents v1.0 envelopes with the WorkManager's URN as the source. The publisher is best-effort: failures are logged but never propagated, so an unreachable API does not break the WorkManager's worker state machine.

public class ApiLifecyclePublisher
Inheritance
ApiLifecyclePublisher
Inherited Members

Constructors

ApiLifecyclePublisher(ILogger<ApiLifecyclePublisher>, PubsubClient)

public ApiLifecyclePublisher(ILogger<ApiLifecyclePublisher> logger, Pubsub.PubsubClient pubsub)

Parameters

logger ILogger<ApiLifecyclePublisher>
pubsub Pubsub.PubsubClient

Methods

PublishWorkerEventAsync(string, Guid, string?, Exception?, CancellationToken)

Publish a lifecycle event for workerId in state (a WorkerEvents value).

public Task PublishWorkerEventAsync(string state, Guid workerId, string? topic, Exception? error = null, CancellationToken cancellationToken = default)

Parameters

state string
workerId Guid
topic string
error Exception
cancellationToken CancellationToken

Returns

Task

PublishWorkerLoadedAsync(Guid, string?, IReadOnlyDictionary<string, string>?, CancellationToken)

The async-create loaded event: like PublishWorkerEventAsync(string, Guid, string?, Exception?, CancellationToken) plus the worker's resolved Virtufin.* library versions, when known.

public Task PublishWorkerLoadedAsync(Guid workerId, string? topic, IReadOnlyDictionary<string, string>? libraries, CancellationToken cancellationToken = default)

Parameters

workerId Guid
topic string
libraries IReadOnlyDictionary<string, string>
cancellationToken CancellationToken

Returns

Task