Skip to content

Commit 9e9ea4e

Browse files
committed
Update reference docs for Durable v2.1.0
1 parent c0be511 commit 9e9ea4e

File tree

4 files changed

+118
-15
lines changed

4 files changed

+118
-15
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ manager: jeconnoc
77
keywords:
88
ms.service: azure-functions
99
ms.topic: conceptual
10-
ms.date: 11/02/2019
10+
ms.date: 12/17/2019
1111
ms.author: azfuncdf
1212
---
1313

@@ -398,7 +398,7 @@ Every entity function has a parameter type of `IDurableEntityContext`, which has
398398
* **DeleteState()**: deletes the state of the entity.
399399
* **GetInput\<TInput>()**: gets the input for the current operation. The `TInput` type parameter must be a primitive or JSON-serializeable type.
400400
* **Return(arg)**: returns a value to the orchestration that called the operation. The `arg` parameter must be a primitive or JSON-serializeable object.
401-
* **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.
401+
* **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.
402402
* **CreateNewOrchestration(orchestratorFunctionName, input)**: starts a new orchestration. The `input` parameter must be a primitive or JSON-serializeable object.
403403

404404
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.
@@ -535,6 +535,7 @@ In .NET functions, you typically bind to `IDurableEntityClient`, which gives you
535535

536536
* **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.
537537
* **SignalEntityAsync**: sends a one-way message to an entity, and waits for it to be enqueued.
538+
* **ListEntitiesAsync**: queries for the state of multiple entities. Entities can be queried by *name* and *last operation time*.
538539

539540
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.
540541

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ manager: jeconnoc
77
keywords:
88
ms.service: azure-functions
99
ms.topic: overview
10-
ms.date: 11/02/2019
10+
ms.date: 12/17/2019
1111
ms.author: azfuncdf
1212
#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.
1313
---
@@ -41,6 +41,7 @@ To invoke an operation on an entity, one specifies
4141
* The *entity ID* of the target entity
4242
* The *operation name*, a string that specifies the operation to perform. For example, the counter entity could support "add", "get", or "reset" operations.
4343
* The *operation input*, which is an optional input parameter for the operation. For example, the "add" operation can take an integer amount as the input.
44+
* The *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.
4445

4546
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.
4647

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

Lines changed: 104 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ manager: jeconnoc
77
keywords:
88
ms.service: azure-functions
99
ms.topic: conceptual
10-
ms.date: 09/07/2019
10+
ms.date: 12/17/2019
1111
ms.author: azfuncdf
1212
---
1313

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

621621
```http
622-
POST /runtime/webhooks/durabletask/entities/{entityType}/{entityKey}
622+
POST /runtime/webhooks/durabletask/entities/{entityName}/{entityKey}
623623
?taskHub={taskHub}
624624
&connection={connectionName}
625625
&code={systemKey}
@@ -630,8 +630,8 @@ Request parameters for this API include the default set mentioned previously as
630630

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

@@ -644,17 +644,20 @@ Content-Type: application/json
644644
5
645645
```
646646

647+
> [!NOTE]
648+
> 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.
649+
647650
### Response
648651

649652
This operation has several possible responses:
650653

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

655658
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.
656659

657-
## Query entity
660+
## Get entity
658661

659662
Gets the state of the specified entity.
660663

@@ -663,7 +666,7 @@ Gets the state of the specified entity.
663666
The HTTP request is formatted as follows (multiple lines are shown for clarity):
664667

665668
```http
666-
GET /runtime/webhooks/durabletask/entities/{entityType}/{entityKey}
669+
GET /runtime/webhooks/durabletask/entities/{entityName}/{entityKey}
667670
?taskHub={taskHub}
668671
&connection={connectionName}
669672
&code={systemKey}
@@ -693,6 +696,100 @@ If the `Counter` entity simply contained a number of steps saved in a `currentVa
693696
}
694697
```
695698

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

698795
> [!div class="nextstepaction"]

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)