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
Copy file name to clipboardExpand all lines: articles/azure-functions/durable/durable-functions-bindings.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Bindings for Durable Functions - Azure
3
3
description: How to use triggers and bindings for the Durable Functions extension for Azure Functions.
4
4
ms.topic: conceptual
5
-
ms.date: 11/02/2019
5
+
ms.date: 12/17/2019
6
6
ms.author: azfuncdf
7
7
---
8
8
@@ -393,7 +393,7 @@ Every entity function has a parameter type of `IDurableEntityContext`, which has
393
393
***DeleteState()**: deletes the state of the entity.
394
394
***GetInput\<TInput>()**: gets the input for the current operation. The `TInput` type parameter must be a primitive or JSON-serializeable type.
395
395
***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.
397
397
***CreateNewOrchestration(orchestratorFunctionName, input)**: starts a new orchestration. The `input` parameter must be a primitive or JSON-serializeable object.
398
398
399
399
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
530
530
531
531
***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.
532
532
***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*.
533
534
534
535
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.
description: Learn what durable entities are and how to use them in the Durable Functions extension for Azure Functions.
4
4
author: cgillum
5
5
ms.topic: overview
6
-
ms.date: 11/02/2019
6
+
ms.date: 12/17/2019
7
7
ms.author: azfuncdf
8
8
#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.
9
9
---
@@ -37,6 +37,7 @@ To invoke an operation on an entity, specify the:
37
37
***Entity ID** of the target entity.
38
38
***Operation name**, which is a string that specifies the operation to perform. For example, the `Counter` entity could support `add`, `get`, or `reset` operations.
39
39
***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.
40
41
41
42
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.
> 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
+
643
646
### Response
644
647
645
648
This operation has several possible responses:
646
649
647
650
***HTTP 202 (Accepted)**: The signal operation was accepted for asynchronous processing.
648
651
***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.
650
653
651
654
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.
652
655
653
-
## Query entity
656
+
## Get entity
654
657
655
658
Gets the state of the specified entity.
656
659
@@ -659,7 +662,7 @@ Gets the state of the specified entity.
659
662
The HTTP request is formatted as follows (multiple lines are shown for clarity):
660
663
661
664
```http
662
-
GET /runtime/webhooks/durabletask/entities/{entityType}/{entityKey}
665
+
GET /runtime/webhooks/durabletask/entities/{entityName}/{entityKey}
663
666
?taskHub={taskHub}
664
667
&connection={connectionName}
665
668
&code={systemKey}
@@ -689,6 +692,100 @@ If the `Counter` entity simply contained a number of steps saved in a `currentVa
689
692
}
690
693
```
691
694
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:
|**`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):
*[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)
31
32
32
33
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.
@@ -77,7 +78,8 @@ Configuration settings for [Durable Functions](../articles/azure-functions/durab
77
78
"maxConcurrentActivityFunctions": 10,
78
79
"maxConcurrentOrchestratorFunctions": 10,
79
80
"extendedSessionsEnabled": false,
80
-
"extendedSessionIdleTimeoutInSeconds": 30
81
+
"extendedSessionIdleTimeoutInSeconds": 30,
82
+
"useGracefulShutdown": false
81
83
}
82
84
}
83
85
```
@@ -88,6 +90,7 @@ Task hub names must start with a letter and consist of only letters and numbers.
88
90
|---------|---------|---------|
89
91
|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.|
90
92
|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.|
91
94
|partitionCount |4|The partition count for the control queue. May be a positive integer between 1 and 16.|
92
95
|controlQueueVisibilityTimeout |5 minutes|The visibility timeout of dequeued control queue messages.|
93
96
|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.
104
107
|eventGridPublishRetryCount|0|The number of times to retry if publishing to the Event Grid Topic fails.|
105
108
|eventGridPublishRetryInterval|5 minutes|The Event Grid publishes retry interval in the *hh:mm:ss* format.|
106
109
|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.|
107
111
108
112
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