Interface IWorkerRuntimeActor
- Namespace
- Virtufin.WorkManager.Shared.Actors
- Assembly
- Virtufin.WorkManager.dll
The Runtime's per-worker actor, called by the WorkManager (and by the Runtime itself to dispatch events). Every type a method passes must be in Virtufin.WorkManager.Shared.Actors.WorkerRuntimeActorJsonContext.
Not compiled into this project: the WorkManager and the Runtime each
compile this file (a linked Compile item), because Dapr.Actors.Next's
source generator emits proxies and dispatchers only for an actor interface
in the compilation's own source.
[GenerateActorClient]
public interface IWorkerRuntimeActor : IActor
Methods
CreateAsync(CreateRuntimeWorkerPayload, CancellationToken)
Register the worker (status loading) without loading its code, so CreateWorker returns immediately.
Task CreateAsync(CreateRuntimeWorkerPayload body, CancellationToken cancellationToken = default)
Parameters
bodyCreateRuntimeWorkerPayloadcancellationTokenCancellationToken
Returns
DeleteAsync(CancellationToken)
Task DeleteAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
LoadAsync(CancellationToken)
Load the registered worker's code (fetch, dependency resolution, engine load). Idempotent; reports a load failure in the result instead of throwing.
Task<RuntimeLoadResult> LoadAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
- Task<RuntimeLoadResult>
LoadCodeAsync(LoadRuntimeCodePayload, CancellationToken)
Task LoadCodeAsync(LoadRuntimeCodePayload body, CancellationToken cancellationToken = default)
Parameters
bodyLoadRuntimeCodePayloadcancellationTokenCancellationToken
Returns
ProcessAsync(byte[], CancellationToken)
Process one event in the worker wire protocol: a protobuf
CloudEvent in, a protobuf CloudEventBatch out (empty = no
output), see Virtufin.Worker.Host.CloudEventProtoCodec.
Task<byte[]> ProcessAsync(byte[] cloudEvent, CancellationToken cancellationToken = default)
Parameters
cloudEventbyte[]cancellationTokenCancellationToken
Returns
ReloadAsync(CancellationToken)
Re-fetch and reload the worker's code, re-resolving its library dependencies.
Task ReloadAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
StartAsync(CancellationToken)
Task StartAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
StopAsync(CancellationToken)
Task StopAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
TouchAsync(CancellationToken)
No-op; (re)activates the actor, whose activation self-heals the worker.
Task TouchAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken