语言

你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。

InvocationHandler Class

Definition

Base class for handling invocation requests. Only HandleAsync(HttpRequest, HttpResponse, InvocationContext, CancellationToken) is required. Override the optional methods to opt in to GET, cancel, OpenAPI, and AsyncAPI endpoints (they return 404 by default).

public abstract class InvocationHandler
type InvocationHandler = class
Public MustInherit Class InvocationHandler
Inheritance
InvocationHandler
Derived

Remarks

To opt in to the invocations_ws (WebSocket) transport, derive from InvocationWebSocketHandler instead.

Constructors

Name Description
InvocationHandler()

Methods

Name Description
CancelAsync(String, HttpRequest, HttpResponse, InvocationContext, CancellationToken)

Handles POST /invocations/{invocationId}/cancel. Returns 404 by default. Override to support cancellation.

GetAsync(String, HttpRequest, HttpResponse, InvocationContext, CancellationToken)

Handles GET /invocations/{invocationId}. Returns 404 by default. Override to support polling for async/LRO invocations.

GetAsyncApiJsonAsync(HttpRequest, HttpResponse, CancellationToken)

Handles GET /invocations/docs/asyncapi.json. Returns 404 by default. Override to return an AsyncAPI (JSON) spec for the agent's event-driven contract (e.g. the invocations_ws WebSocket protocol) — the AsyncAPI companion to GetOpenApiAsync(HttpRequest, HttpResponse, CancellationToken) for streaming/bidirectional surfaces that OpenAPI cannot express.

GetAsyncApiYamlAsync(HttpRequest, HttpResponse, CancellationToken)

Handles GET /invocations/docs/asyncapi.yaml. Returns 404 by default. Override to return an AsyncAPI (YAML) spec for the agent's event-driven contract. Companion to GetAsyncApiJsonAsync(HttpRequest, HttpResponse, CancellationToken); each format is served independently at its own path.

GetOpenApiAsync(HttpRequest, HttpResponse, CancellationToken)

Handles GET /invocations/docs/openapi.json. Returns 404 by default. Override to return an OpenAPI spec for the agent's contract.

HandleAsync(HttpRequest, HttpResponse, InvocationContext, CancellationToken)

Handles a POST /invocations request. Required.

Applies to