Skip to content

Commit d7c469c

Browse files
authored
Merge pull request #99519 from cgillum/cgillum-edits
Update reference docs for Durable v2.1.0
2 parents 685c28a + fc871e7 commit d7c469c

File tree

5 files changed

+120
-16
lines changed

5 files changed

+120
-16
lines changed

articles/azure-functions/durable/durable-functions-bindings.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Bindings for Durable Functions - Azure
33
description: How to use triggers and bindings for the Durable Functions extension for Azure Functions.
44
ms.topic: conceptual
5-
ms.date: 11/02/2019
5+
ms.date: 12/17/2019
66
ms.author: azfuncdf
77
---
88

@@ -393,7 +393,7 @@ Every entity function has a parameter type of `IDurableEntityContext`, which has
393393
* **DeleteState()**: deletes the state of the entity.
394394
* **GetInput\<TInput>()**: gets the input for the current operation. The `TInput` type parameter must be a primitive or JSON-serializeable type.
395395
* **Return(arg)**: returns a value to the orchestration that called the operation. The `arg` parameter must be a primitive or JSON-serializeable object.
396-
* **SignalEntity(EntityId, operation, input)**: sends a one-way message to an entity. The `operation` parameter must be a non-null string, and the `input` parameter must be a primitive or JSON-serializeable object.
396+
* **SignalEntity(EntityId, scheduledTimeUtc, operation, input)**: sends a one-way message to an entity. The `operation` parameter must be a non-null string, the optional `scheduledTimeUtc` must be a UTC datetime at which to invoke the operation, and the `input` parameter must be a primitive or JSON-serializeable object.
397397
* **CreateNewOrchestration(orchestratorFunctionName, input)**: starts a new orchestration. The `input` parameter must be a primitive or JSON-serializeable object.
398398

399399
The `IDurableEntityContext` object passed to the entity function can be accessed using the `Entity.Current` async-local property. This approach is convenient when using the class-based programming model.
@@ -530,6 +530,7 @@ In .NET functions, you typically bind to `IDurableEntityClient`, which gives you
530530

531531
* **ReadEntityStateAsync\<T>**: reads the state of an entity. It returns a response that indicates whether the target entity exists, and if so, what its state is.
532532
* **SignalEntityAsync**: sends a one-way message to an entity, and waits for it to be enqueued.
533+
* **ListEntitiesAsync**: queries for the state of multiple entities. Entities can be queried by *name* and *last operation time*.
533534

534535
There is no need to create the target entity before sending a signal - the entity state can be created from within the entity function that handles the signal.
535536

articles/azure-functions/durable/durable-functions-entities.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Durable entities - Azure Functions
33
description: Learn what durable entities are and how to use them in the Durable Functions extension for Azure Functions.
44
author: cgillum
55
ms.topic: overview
6-
ms.date: 11/02/2019
6+
ms.date: 12/17/2019
77
ms.author: azfuncdf
88
#Customer intent: As a developer, I want to learn what durable entities are and how to use them to solve distributed, stateful problems in my applications.
99
---
@@ -37,6 +37,7 @@ To invoke an operation on an entity, specify the:
3737
* **Entity ID** of the target entity.
3838
* **Operation name**, which is a string that specifies the operation to perform. For example, the `Counter` entity could support `add`, `get`, or `reset` operations.
3939
* **Operation input**, which is an optional input parameter for the operation. For example, the add operation can take an integer amount as the input.
40+
* **Scheduled time*, which is an optional parameter for specifying the delivery time of the operation. For example, an operation can be reliably scheduled to run several days in the future.
4041

4142
Operations can return a result value or an error result, such as a JavaScript error or a .NET exception. This result or error can be observed by orchestrations that called the operation.
4243

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

Lines changed: 104 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: HTTP APIs in Durable Functions - Azure Functions
33
description: Learn how to implement HTTP APIs in the Durable Functions extension for Azure Functions.
44
author: cgillum
55
ms.topic: conceptual
6-
ms.date: 09/07/2019
6+
ms.date: 12/17/2019
77
ms.author: azfuncdf
88
---
99

@@ -615,7 +615,7 @@ Sends a one-way operation message to a [Durable Entity](durable-functions-types-
615615
The HTTP request is formatted as follows (multiple lines are shown for clarity):
616616

617617
```http
618-
POST /runtime/webhooks/durabletask/entities/{entityType}/{entityKey}
618+
POST /runtime/webhooks/durabletask/entities/{entityName}/{entityKey}
619619
?taskHub={taskHub}
620620
&connection={connectionName}
621621
&code={systemKey}
@@ -626,8 +626,8 @@ Request parameters for this API include the default set mentioned previously as
626626

627627
| Field | Parameter type | Description |
628628
|-------------------|-----------------|-------------|
629-
| **`entityType`** | URL | The type of the entity. |
630-
| **`entityKey`** | URL | The unique name of the entity. |
629+
| **`entityName`** | URL | The name (type) of the entity. |
630+
| **`entityKey`** | URL | The key (unique ID) of the entity. |
631631
| **`op`** | Query string | Optional. The name of the user-defined operation to invoke. |
632632
| **`{content}`** | Request content | The JSON-formatted event payload. |
633633

@@ -640,17 +640,20 @@ Content-Type: application/json
640640
5
641641
```
642642

643+
> [!NOTE]
644+
> By default with [class-based entities in .NET](durable-functions-dotnet-entities.md#defining-entity-classes), specifying the `op` value of `delete` will delete the state of an entity. If the entity defines an operation named `delete`, however, that user-defined operation will be invoked instead.
645+
643646
### Response
644647

645648
This operation has several possible responses:
646649

647650
* **HTTP 202 (Accepted)**: The signal operation was accepted for asynchronous processing.
648651
* **HTTP 400 (Bad request)**: The request content was not of type `application/json`, was not valid JSON, or had an invalid `entityKey` value.
649-
* **HTTP 404 (Not Found)**: The specified `entityType` was not found.
652+
* **HTTP 404 (Not Found)**: The specified `entityName` was not found.
650653

651654
A successful HTTP request does not contain any content in the response. A failed HTTP request may contain JSON-formatted error information in the response content.
652655

653-
## Query entity
656+
## Get entity
654657

655658
Gets the state of the specified entity.
656659

@@ -659,7 +662,7 @@ Gets the state of the specified entity.
659662
The HTTP request is formatted as follows (multiple lines are shown for clarity):
660663

661664
```http
662-
GET /runtime/webhooks/durabletask/entities/{entityType}/{entityKey}
665+
GET /runtime/webhooks/durabletask/entities/{entityName}/{entityKey}
663666
?taskHub={taskHub}
664667
&connection={connectionName}
665668
&code={systemKey}
@@ -689,6 +692,100 @@ If the `Counter` entity simply contained a number of steps saved in a `currentVa
689692
}
690693
```
691694

695+
## List entities
696+
697+
You can query for multiple entities by the entity name or by the last operation date.
698+
699+
### Request
700+
701+
The HTTP request is formatted as follows (multiple lines are shown for clarity):
702+
703+
```http
704+
GET /runtime/webhooks/durabletask/entities/{entityName}
705+
?taskHub={taskHub}
706+
&connection={connectionName}
707+
&code={systemKey}
708+
&lastOperationTimeFrom={timestamp}
709+
&lastOperationTimeTo={timestamp}
710+
&fetchState=[true|false]
711+
&top={integer}
712+
```
713+
714+
Request parameters for this API include the default set mentioned previously as well as the following unique parameters:
715+
716+
| Field | Parameter type | Description |
717+
|-----------------------------|-----------------|-------------|
718+
| **`entityName`** | URL | Optional. When specified, filters the list of returned entities by their entity name (case-insensitive). |
719+
| **`fetchState`** | Query string | Optional parameter. If set to `true`, the entity state will be included in the response payload. |
720+
| **`lastOperationTimeFrom`** | Query string | Optional parameter. When specified, filters the list of returned entities that processed operations after the given ISO8601 timestamp. |
721+
| **`lastOperationTimeTo`** | Query string | Optional parameter. When specified, filters the list of returned entities that processed operations before the given ISO8601 timestamp. |
722+
| **`top`** | Query string | Optional parameter. When specified, limits the number of entities returned by the query. |
723+
724+
725+
### Response
726+
727+
A successful HTTP 200 response contains a JSON-serialized array of entities and optionally the state of each entity.
728+
729+
By default the operation returns the first 100 entities that match the query criteria. The caller can specify a query string parameter value for `top` to return a different maximum number of results. If more results exist beyond what is returned, a continuation token is also returned in the response header. The name of the header is `x-ms-continuation-token`.
730+
731+
If you set continuation token value in the next request header, you can get the next page of results. This name of the request header is also `x-ms-continuation-token`.
732+
733+
### Example - list all entities
734+
735+
The following example HTTP request lists all entities in the task hub:
736+
737+
```http
738+
GET /runtime/webhooks/durabletask/entities
739+
```
740+
741+
The response JSON may look like the following (formatted for readability):
742+
743+
```json
744+
[
745+
{
746+
"entityId": { "key": "cats", "name": "counter" },
747+
"lastOperationTime": "2019-12-18T21:45:44.6326361Z",
748+
},
749+
{
750+
"entityId": { "key": "dogs", "name": "counter" },
751+
"lastOperationTime": "2019-12-18T21:46:01.9477382Z"
752+
},
753+
{
754+
"entityId": { "key": "mice", "name": "counter" },
755+
"lastOperationTime": "2019-12-18T21:46:15.4626159Z"
756+
},
757+
{
758+
"entityId": { "key": "radio", "name": "device" },
759+
"lastOperationTime": "2019-12-18T21:46:18.2616154Z"
760+
},
761+
]
762+
```
763+
764+
### Example - filtering the list of entities
765+
766+
The following example HTTP request lists just the first two entities of type `counter` and also fetches their state:
767+
768+
```http
769+
GET /runtime/webhooks/durabletask/entities/counter?top=2&fetchState=true
770+
```
771+
772+
The response JSON may look like the following (formatted for readability):
773+
774+
```json
775+
[
776+
{
777+
"entityId": { "key": "cats", "name": "counter" },
778+
"lastOperationTime": "2019-12-18T21:45:44.6326361Z",
779+
"state": { "value": 9 }
780+
},
781+
{
782+
"entityId": { "key": "dogs", "name": "counter" },
783+
"lastOperationTime": "2019-12-18T21:46:01.9477382Z",
784+
"state": { "value": 10 }
785+
}
786+
]
787+
```
788+
692789
## Next steps
693790

694791
> [!div class="nextstepaction"]

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ The following built-in HTTP APIs are supported.
2727
* [Send an external event to an orchestration](durable-functions-http-api.md#raise-event)
2828
* [Purge orchestration history](durable-functions-http-api.md#purge-single-instance-history)
2929
* [Send an operation event to an entity](durable-functions-http-api.md#signal-entity)
30-
* [Query the state of an entity](durable-functions-http-api.md#query-entity)
30+
* [Get the state of an entity](durable-functions-http-api.md#get-entity)
31+
* [Query the list of entities](durable-functions-http-api.md#list-entities)
3132

3233
See the [HTTP APIs article](durable-functions-http-api.md) for a full description of all the built-in HTTP APIs exposed by the Durable Functions extension.
3334

includes/functions-host-json-durabletask.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,15 @@ Configuration settings for [Durable Functions](../articles/azure-functions/durab
4747
"durableTask": {
4848
"hubName": "MyTaskHub",
4949
"storageProvider": {
50+
"connectionStringName": "AzureWebJobsStorage",
5051
"controlQueueBatchSize": 32,
51-
"partitionCount": 4,
52+
"controlQueueBufferThreshold": 256,
5253
"controlQueueVisibilityTimeout": "00:05:00",
53-
"workItemQueueVisibilityTimeout": "00:05:00",
5454
"maxQueuePollingInterval": "00:00:30",
55-
"connectionStringName": "AzureWebJobsStorage",
55+
"partitionCount": 4,
5656
"trackingStoreConnectionStringName": "TrackingStorage",
57-
"trackingStoreNamePrefix": "DurableTask"
57+
"trackingStoreNamePrefix": "DurableTask",
58+
"workItemQueueVisibilityTimeout": "00:05:00",
5859
},
5960
"tracing": {
6061
"traceInputsAndOutputs": false,
@@ -77,7 +78,8 @@ Configuration settings for [Durable Functions](../articles/azure-functions/durab
7778
"maxConcurrentActivityFunctions": 10,
7879
"maxConcurrentOrchestratorFunctions": 10,
7980
"extendedSessionsEnabled": false,
80-
"extendedSessionIdleTimeoutInSeconds": 30
81+
"extendedSessionIdleTimeoutInSeconds": 30,
82+
"useGracefulShutdown": false
8183
}
8284
}
8385
```
@@ -88,6 +90,7 @@ Task hub names must start with a letter and consist of only letters and numbers.
8890
|---------|---------|---------|
8991
|hubName|DurableFunctionsHub|Alternate [task hub](../articles/azure-functions/durable-functions-task-hubs.md) names can be used to isolate multiple Durable Functions applications from each other, even if they're using the same storage backend.|
9092
|controlQueueBatchSize|32|The number of messages to pull from the control queue at a time.|
93+
|controlQueueBufferThreshold|256|The number of control queue messages that can be buffered in memory at a time, at which point the dispatcher will wait before dequeuing any additional messages.|
9194
|partitionCount |4|The partition count for the control queue. May be a positive integer between 1 and 16.|
9295
|controlQueueVisibilityTimeout |5 minutes|The visibility timeout of dequeued control queue messages.|
9396
|workItemQueueVisibilityTimeout |5 minutes|The visibility timeout of dequeued work item queue messages.|
@@ -104,5 +107,6 @@ Task hub names must start with a letter and consist of only letters and numbers.
104107
|eventGridPublishRetryCount|0|The number of times to retry if publishing to the Event Grid Topic fails.|
105108
|eventGridPublishRetryInterval|5 minutes|The Event Grid publishes retry interval in the *hh:mm:ss* format.|
106109
|eventGridPublishEventTypes||A list of event types to publish to Event Grid. If not specified, all event types will be published. Allowed values include `Started`, `Completed`, `Failed`, `Terminated`.|
110+
|useGracefulShutdown|false|(Preview) Enable gracefully shutting down to reduce the chance of host shutdowns failing in-process function executions.|
107111

108112
Many of these settings are for optimizing performance. For more information, see [Performance and scale](../articles/azure-functions/durable-functions-perf-and-scale.md).

0 commit comments

Comments
 (0)