Share via


IMiddleware.OnTurnAsync(ITurnContext, NextDelegate, CancellationToken) Method

Definition

When implemented in middleware, processes an incoming activity.

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

Parameters

turnContext
ITurnContext

The context object for this turn.

next
NextDelegate

The delegate to call to continue the bot middleware pipeline.

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.

Remarks

Middleware calls the next delegate to pass control to the next middleware in the pipeline. If middleware doesn’t call the next delegate, the adapter does not call any of the subsequent middleware’s request handlers or the bot’s receive handler, and the pipeline short circuits.

The turnContext provides information about the incoming activity, and other data needed to process the activity.

Applies to

See also