MiddlewareSet Class

  • java.lang.Object
    • com.microsoft.bot.builder.MiddlewareSet

Implements

public class MiddlewareSet
implements Middleware

Contains an ordered set of Middleware.

Constructor Summary

Constructor Description
MiddlewareSet()

Method Summary

Modifier and Type Method and Description
java.util.concurrent.CompletableFuture<java.lang.Void> onTurn(TurnContext turnContext, NextDelegate next)

Processes an incoming activity.

java.util.concurrent.CompletableFuture<java.lang.Void> receiveActivityWithStatus(TurnContext context, BotCallbackHandler callback)

Processes an activity.

MiddlewareSet use(Middleware middleware)

Adds a middleware object to the end of the set.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

MiddlewareSet

public MiddlewareSet()

Method Details

onTurn

public CompletableFuture onTurn(TurnContext turnContext, NextDelegate next)

Processes an incoming activity.

Parameters:

turnContext - The context object for this turn.
next - The delegate to call to continue the bot middleware pipeline.

Returns:

A task that represents the work queued to execute. Middleware calls the next delegate to pass control to the next middleware in the pipeline. If middleware doesn\u2019t call the next delegate, the adapter does not call any of the subsequent middleware\u2019s request handlers or the bot\u2019s receive handler, and the pipeline short circuits.

The context provides information about the incoming activity, and other data needed to process the activity. TurnContext Activity

receiveActivityWithStatus

public CompletableFuture receiveActivityWithStatus(TurnContext context, BotCallbackHandler callback)

Processes an activity.

Parameters:

context - The context object for the turn.
callback - The delegate to call when the set finishes processing the activity.

Returns:

A task that represents the work queued to execute.

use

public MiddlewareSet use(Middleware middleware)

Adds a middleware object to the end of the set.

Parameters:

middleware - The middleware to add.

Returns:

The updated middleware set.

Applies to