You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -38,10 +38,39 @@ See the [HTTP APIs article](durable-functions-http-api.md) for a full descriptio
38
38
39
39
The [orchestration client binding](durable-functions-bindings.md#orchestration-client) exposes APIs that can generate convenient HTTP response payloads. For example, it can create a response containing links to management APIs for a specific orchestration instance. The following examples show an HTTP-trigger function that demonstrates how to use this API for a new orchestration instance:
> The `CreateCheckStatusResponse` and related APIs currently only support `HttpRequestData` and `HttpResponseData` types when working with HTTP-triggered functions. ASP.NET-defined types are not currently supported.
73
+
45
74
# [JavaScript](#tab/javascript)
46
75
47
76
**index.js**
@@ -222,10 +251,10 @@ Starting with Durable Functions 2.0, orchestrations can natively consume HTTP AP
222
251
223
252
The following example code shows an orchestrator function making an outbound HTTP request:
@@ -242,6 +271,36 @@ public static async Task CheckSiteAvailable(
242
271
}
243
272
```
244
273
274
+
> [!NOTE]
275
+
> You might wonder why this feature uses the **DurableHttpRequest** and **DurableHttpResponse** types instead of the built-in .NET **HttpRequestMessage** and **HttpResponseMessage** types.
276
+
>
277
+
> This design choice is intentional. The primary reason is that custom types help ensure users don't make incorrect assumptions about the supported behaviors of the internal HTTP client. Types specific to Durable Functions also make it possible to simplify API design. They also can more easily make available special features like [managed identity integration](#managed-identities) and the [polling consumer pattern](#http-202-handling).
// Makes an HTTP GET request to the specified endpoint
289
+
DurableHttpResponseresponse=
290
+
awaitcontext.CallHttpAsync(HttpMethod.Get, url);
291
+
292
+
if (response.StatusCode>=HttpStatusCode.BadRequest)
293
+
{
294
+
// handling of error codes goes here
295
+
}
296
+
}
297
+
```
298
+
299
+
> [!NOTE]
300
+
> You might wonder why this feature uses the **DurableHttpRequest** and **DurableHttpResponse** types instead of the built-in .NET **HttpRequestMessage** and **HttpResponseMessage** types.
301
+
>
302
+
> This design choice is intentional. The primary reason is that custom types help ensure users don't make incorrect assumptions about the supported behaviors of the internal HTTP client. Types specific to Durable Functions also make it possible to simplify API design. They also can more easily make available special features that aren't part of the built-in framework types.
303
+
245
304
# [JavaScript](#tab/javascript)
246
305
247
306
```javascript
@@ -291,21 +350,21 @@ By using the "call HTTP" action, you can do the following actions in your orches
291
350
292
351
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.
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.
297
356
298
357
> [!NOTE]
299
358
> 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.
300
-
> 2.Due to a temporary limitation, the built-in HTTP polling pattern is not currently available in JavaScript/TypeScript and Python.
359
+
> 2.The built-in HTTP polling pattern is currently available only in the .NET in-process host.
301
360
302
361
### Managed identities
303
362
304
363
Durable Functions natively supports calls to APIs that accept Microsoft Entra tokens for authorization. This support uses [Azure managed identities](../../active-directory/managed-identities-azure-resources/overview.md) to acquire these tokens.
305
364
306
365
The following code is an example of an orchestrator function. The function makes authenticated calls to restart a virtual machine by using the Azure Resource Manager [virtual machines REST API](/rest/api/compute/virtualmachines).
307
366
308
-
# [C#](#tab/csharp)
367
+
# [C# (InProc)](#tab/csharp-inproc)
309
368
310
369
```csharp
311
370
[FunctionName("RestartVm")]
@@ -331,6 +390,10 @@ public static async Task RunOrchestrator(
331
390
}
332
391
```
333
392
393
+
# [C# (Isolated)](#tab/csharp-isolated)
394
+
395
+
This feature isn't yet available in the .NET Isolated worker.
396
+
334
397
# [JavaScript](#tab/javascript)
335
398
336
399
```javascript
@@ -414,14 +477,9 @@ HTTP requests sent by orchestrator functions and their responses are [serialized
414
477
415
478
If any of these limitations might affect your use case, consider instead using activity functions and language-specific HTTP client libraries to make outbound HTTP calls.
416
479
417
-
> [!NOTE]
418
-
> If you are a .NET developer, you might wonder why this feature uses the **DurableHttpRequest** and **DurableHttpResponse** types instead of the built-in .NET **HttpRequestMessage** and **HttpResponseMessage** types.
419
-
>
420
-
> This design choice is intentional. The primary reason is that custom types help ensure users don't make incorrect assumptions about the supported behaviors of the internal HTTP client. Types specific to Durable Functions also make it possible to simplify API design. They also can more easily make available special features like [managed identity integration](#managed-identities) and the [polling consumer pattern](#http-202-handling).
Customizing the behavior of the orchestration's internal HTTP client is possible using [Azure Functions .NET dependency injection](../functions-dotnet-dependency-injection.md). This ability can be useful for making small behavioral changes. It can also be useful for unit testing the HTTP client by injecting mock objects.
482
+
Customizing the behavior of the orchestration's internal HTTP client is possible using [Azure Functions .NET dependency injection](../functions-dotnet-dependency-injection.md) for the in-process worker. This ability can be useful for making small behavioral changes. It can also be useful for unit testing the HTTP client by injecting mock objects.
425
483
426
484
The following example demonstrates using dependency injection to disable TLS/SSL certificate validation for orchestrator functions that call external HTTP endpoints.
0 commit comments