Class WorkerHeartbeatService
- Namespace
- Virtufin.WorkManager.Services
- Assembly
- Virtufin.WorkManager.dll
Periodically touches the actor for every worker registered locally on this instance, so a running worker's actor never gets idle-deactivated out from under it. See TouchAsync(CancellationToken)'s doc comment for why this is needed: message dispatch for a running worker happens entirely through WorkManager's topic-subscription pool, never through an actor method call, so a worker actively processing messages can still look idle to Dapr's actor runtime.
public sealed class WorkerHeartbeatService : BackgroundService, IHostedService, IDisposable
- Inheritance
-
WorkerHeartbeatService
- Implements
- Inherited Members
Constructors
WorkerHeartbeatService(WorkManager, IActorProxyFactory, ILogger<WorkerHeartbeatService>)
public WorkerHeartbeatService(WorkManager workManager, IActorProxyFactory actorProxies, ILogger<WorkerHeartbeatService> logger)
Parameters
workManagerWorkManageractorProxiesIActorProxyFactoryloggerILogger<WorkerHeartbeatService>
Methods
ExecuteAsync(CancellationToken)
This method is called when the IHostedService starts. The implementation should return a task that represents the lifetime of the long running operation(s) being performed.
protected override Task ExecuteAsync(CancellationToken stoppingToken)
Parameters
stoppingTokenCancellationTokenTriggered when StopAsync(CancellationToken) is called.
Returns
Remarks
See Worker Services in .NET for implementation guidelines.