Share via


ActivityHandler.OnTurnAsync(ITurnContext, CancellationToken) Method

Definition

Called by the adapter (for example, a BotFrameworkAdapter) at runtime in order to process an inbound Activity.

public virtual System.Threading.Tasks.Task OnTurnAsync (Microsoft.Bot.Builder.ITurnContext turnContext, System.Threading.CancellationToken cancellationToken = default);
abstract member OnTurnAsync : Microsoft.Bot.Builder.ITurnContext * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.OnTurnAsync : Microsoft.Bot.Builder.ITurnContext * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function OnTurnAsync (turnContext As ITurnContext, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

turnContext
ITurnContext

The context object for this turn.

cancellationToken
CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

A task that represents the work queued to execute.

Implements

Remarks

This method calls other methods in this class based on the type of the activity to process, which allows a derived class to provide type-specific logic in a controlled way.

In a derived class, override this method to add logic that applies to all activity types. Add logic to apply before the type-specific logic before the call to the base class OnTurnAsync(ITurnContext, CancellationToken) method. Add logic to apply after the type-specific logic after the call to the base class OnTurnAsync(ITurnContext, CancellationToken) method.

Applies to

See also