Share via


StatelessService.RunAsync(CancellationToken) Method

Definition

Services that want to implement a background task, which runs when the service comes up, should override this method with their logic.

For information about Reliable Services life cycle please see https://docs.microsoft.com/azure/service-fabric/service-fabric-reliable-services-lifecycle

protected virtual System.Threading.Tasks.Task RunAsync (System.Threading.CancellationToken cancellationToken);
abstract member RunAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.RunAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task
Protected Overridable Function RunAsync (cancellationToken As CancellationToken) As Task

Parameters

cancellationToken
CancellationToken

Cancellation token to monitor for cancellation requests.

Returns

A Task that represents outstanding operation.

Remarks

Please ensure you follow these guidelines when overriding RunAsync(CancellationToken):

Failing to conform to these guidelines can cause fail-over, reconfiguration or upgrade of your service to get stuck and can impact availability of your service.

Applies to