Skip to content

Commit 63ff867

Browse files
authored
Update durable-functions-http-features.md
1 parent bd14e77 commit 63ff867

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

articles/azure-functions/durable/durable-functions-http-features.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,45 @@ By using the "call HTTP" action, you can do the following actions in your orches
350350

351351
The ability to consume HTTP APIs directly from orchestrator functions is intended as a convenience for a certain set of common scenarios. You can implement all of these features yourself using activity functions. In many cases, activity functions might give you more flexibility.
352352

353-
### <a name="http-202-handling"></a>HTTP 202 handling (.NET in-process only)
353+
### <a name="http-202-handling"></a>HTTP 202 handling (.NET only)
354354

355355
The "call HTTP" API can automatically implement the client side of the polling consumer pattern. If a called API returns an HTTP 202 response with a Location header, the orchestrator function automatically polls the Location resource until receiving a response other than 202. This response will be the response returned to the orchestrator function code.
356356

357+
# [C# (InProc)](#tab/csharp-inproc)
358+
359+
```csharp
360+
[FunctionName(nameof(CheckSiteAvailable))]
361+
public static async Task CheckSiteAvailableWithPolling(
362+
[OrchestrationTrigger] IDurableOrchestrationContext context)
363+
{
364+
Uri url = context.GetInput<Uri>();
365+
366+
// HTTP automatic polling on 202 response is enabled by default in .NET in-process.
367+
DurableHttpResponse response =
368+
await context.CallHttpAsync(HttpMethod.Get, url);
369+
}
370+
```
371+
372+
# [C# (Isolated)](#tab/csharp-isolated)
373+
374+
```csharp
375+
[Function(nameof(CheckSiteAvailable))]
376+
public static async Task CheckSiteAvailableWithPolling(
377+
[OrchestrationTrigger] TaskOrchestrationContext context)
378+
{
379+
Uri url = context.GetInput<Uri>();
380+
381+
// Enable HTTP automatic polling on 202 response by setting asynchronousPatternEnabled to true.
382+
DurableHttpResponse response =
383+
await context.CallHttpAsync(HttpMethod.Get, url, asynchronousPatternEnabled: true);
384+
}
385+
```
386+
357387
> [!NOTE]
358388
> 1. Orchestrator functions also natively support the server-side polling consumer pattern, as described in [Async operation tracking](#async-operation-tracking). This support means that orchestrations in one function app can easily coordinate the orchestrator functions in other function apps. This is similar to the [sub-orchestration](durable-functions-sub-orchestrations.md) concept, but with support for cross-app communication. This support is particularly useful for microservice-style app development.
359-
> 2. The built-in HTTP polling pattern is currently available only in the .NET in-process host.
389+
> 2. The built-in HTTP polling pattern is currently available only in the .NET host.
390+
> 3. The polling pattern is enabled by default in .NET in-process but disabled by default in .NET out-of-process. If you want to enable it in .NET out-of-process, refer to the sample code and set the asynchronousPatternEnabled argument to true.
391+
> 4. HTTP automatic polling pattern is supported at .NET out-of-process starting from version [v1.5.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.DurableTask) or later.
360392
361393
### Managed identities
362394

0 commit comments

Comments
 (0)