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
+35-35Lines changed: 35 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,12 +53,12 @@ When you write orchestrator functions, the orchestration trigger is defined by t
53
53
::: zone pivot="programming-language-python"
54
54
Azure Functions supports two programming models for Python. The way that you define an orchestration trigger depends on your chosen programming model.
55
55
56
-
# [v2](#tab/python-v2)
56
+
###[v2](#tab/python-v2)
57
57
The Python v2 programming model lets you define an orchestration trigger using the `orchestration_trigger` decorator directly in your Python function code.
58
58
59
59
In the v2 model, the Durable Functions triggers and bindings are accessed from an instance of `DFApp`, which is a subclass of `FunctionApp` that additionally exports Durable Functions-specific decorators.
60
60
61
-
# [v1](#tab/python-v1)
61
+
###[v1](#tab/python-v1)
62
62
When you write orchestrator functions in the Python v1 programming model, the orchestration trigger is defined by the following JSON object in the `bindings` array of the *function.json* file:
63
63
64
64
```json
@@ -82,7 +82,7 @@ Internally, this trigger binding polls the configured durable store for new orch
82
82
83
83
Here are some notes about the orchestration trigger:
84
84
85
-
***Single-threading** - A single dispatcher thread is used for all orchestrator function execution on a single host instance. For this reason, it's important to ensure that orchestrator function code is efficient and doesn't perform any I/O. It is also important to ensure that this thread does not do any async work except when awaiting on Durable Functions-specific task types.
85
+
***Single-threading** - A single dispatcher thread is used for all orchestrator function execution on a single host instance. For this reason, it's important to ensure that orchestrator function code is efficient and doesn't perform any I/O. It's also important to ensure that this thread doesn't do any async work except when awaiting on Durable Functions-specific task types.
86
86
***Poison-message handling** - There's no poison message support in orchestration triggers.
87
87
***Message visibility** - Orchestration trigger messages are dequeued and kept invisible for a configurable duration. The visibility of these messages is renewed automatically as long as the function app is running and healthy.
88
88
***Return values** - Return values are serialized to JSON and persisted to the orchestration history table in Azure Table storage. These return values can be queried by the orchestration client binding, described later.
@@ -101,16 +101,16 @@ Here are some notes about the orchestration trigger:
101
101
The orchestration trigger binding supports both inputs and outputs. Here are some things to know about input and output handling:
102
102
103
103
***inputs** - Orchestration triggers can be invoked with inputs, which are accessed through the context input object. All inputs must be JSON-serializable.
104
-
***outputs** - Orchestration triggers support output values as well as inputs. The return value of the function is used to assign the output value and must be JSON-serializable.
104
+
***outputs** - Orchestration triggers support both output and input values. The return value of the function is used to assign the output value and must be JSON-serializable.
105
105
106
106
### Trigger sample
107
107
108
-
The following example code shows what the simplest "Hello World" orchestrator function might look like. Note that this example orchestrator doesn't actually schedule any tasks.
108
+
The following example code shows what the simplest "Hello World" orchestrator function might look like. This example orchestrator doesn't actually schedule any tasks.
109
109
110
110
::: zone pivot="programming-language-csharp"
111
-
The specific attribute used to define the trigger depends on whether you are running your C# functions [in-process](../functions-dotnet-class-library.md) or in an [isolated worker process](../dotnet-isolated-process-guide.md).
111
+
The specific attribute used to define the trigger depends on whether you're running your C# functions [in-process](../functions-dotnet-class-library.md) or in an [isolated worker process](../dotnet-isolated-process-guide.md).
112
112
113
-
# [In-process](#tab/in-process)
113
+
####[In-process](#tab/in-process)
114
114
115
115
```csharp
116
116
[FunctionName("HelloWorld")]
@@ -124,7 +124,7 @@ public static string Run([OrchestrationTrigger] IDurableOrchestrationContext con
124
124
> [!NOTE]
125
125
> The previous code is for Durable Functions 2.x. For Durable Functions 1.x, you must use `DurableOrchestrationContext` instead of `IDurableOrchestrationContext`. For more information about the differences between versions, see the [Durable Functions Versions](durable-functions-versions.md) article.
126
126
127
-
# [Isolated process](#tab/isolated-process)
127
+
####[Isolated process](#tab/isolated-process)
128
128
129
129
```csharp
130
130
[Function("HelloWorld")]
@@ -135,7 +135,7 @@ public static string Run([OrchestrationTrigger] TaskOrchestrationContext context
135
135
```
136
136
137
137
> [!NOTE]
138
-
> In both Durable functions in-proc and in .NET-isolated, the orchestration input can be extracted via `context.GetInput<T>()`. However, .NET-isolated also supports the input being supplied as a parameter, as shown above. The input binding will bind to the first parameter which has no binding attribute on it and is not a well-known type already covered by other input bindings (ie: `FunctionContext`).
138
+
> In both Durable functions in-proc and in .NET-isolated, the orchestration input can be extracted via `context.GetInput<T>()`. However, .NET-isolated also supports the input being supplied as a parameter, as shown above. The input binds to the first parameter, which has no binding attribute on it and isn't a well-known type already covered by other input bindings, such as `FunctionContext`.
> The `durable-functions` library takes care of calling the synchronous `context.done` method when the generator function exits.
156
156
::: zone-end
157
157
::: zone pivot="programming-language-python"
158
-
# [v2](#tab/python-v2)
158
+
###[v2](#tab/python-v2)
159
159
160
160
```python
161
161
import azure.functions as func
@@ -169,7 +169,7 @@ def my_orchestrator(context):
169
169
return result
170
170
```
171
171
172
-
# [v1](#tab/python-v1)
172
+
###[v1](#tab/python-v1)
173
173
```python
174
174
import azure.durable_functions as df
175
175
@@ -204,7 +204,7 @@ public String helloWorldOrchestration(
204
204
Most orchestrator functions call activity functions, so here is a "Hello World" example that demonstrates how to call an activity function:
205
205
::: zone-end
206
206
::: zone pivot="programming-language-csharp"
207
-
# [In-process](#tab/in-process)
207
+
###[In-process](#tab/in-process)
208
208
209
209
```csharp
210
210
[FunctionName("HelloWorld")]
@@ -220,7 +220,7 @@ public static async Task<string> Run(
220
220
> [!NOTE]
221
221
> The previous code is for Durable Functions 2.x. For Durable Functions 1.x, you must use `DurableOrchestrationContext` instead of `IDurableOrchestrationContext`. For more information about the differences between versions, see the [Durable Functions versions](durable-functions-versions.md) article.
222
222
223
-
# [Isolated process](#tab/isolated-process)
223
+
###[Isolated process](#tab/isolated-process)
224
224
225
225
```csharp
226
226
[Function("HelloWorld")]
@@ -287,10 +287,10 @@ The activity trigger is defined by the following JSON object in the `bindings` a
287
287
::: zone pivot="programming-language-python"
288
288
The way that you define an activity trigger depends on your chosen programming model.
289
289
290
-
# [v2](#tab/python-v2)
290
+
###[v2](#tab/python-v2)
291
291
Using the `activity_trigger` decorator directly in your Python function code.
292
292
293
-
# [v1](#tab/python-v1)
293
+
###[v1](#tab/python-v1)
294
294
The activity trigger is defined by the following JSON object in the `bindings` array of *function.json*:
295
295
296
296
```json
@@ -323,15 +323,15 @@ Here are some notes about the activity trigger:
323
323
The activity trigger binding supports both inputs and outputs, just like the orchestration trigger. Here are some things to know about input and output handling:
324
324
325
325
***inputs** - Activity triggers can be invoked with inputs from an orchestrator function. All inputs must be JSON-serializable.
326
-
***outputs** - Activity functions support output values as well as inputs. The return value of the function is used to assign the output value and must be JSON-serializable.
326
+
***outputs** - Activity functions support both output and input values. The return value of the function is used to assign the output value and must be JSON-serializable.
327
327
***metadata** - .NET activity functions can bind to a `string instanceId` parameter to get the instance ID of the calling orchestration.
328
328
329
329
### Trigger sample
330
330
331
331
The following example code shows what a simple `SayHello` activity function might look like.
332
332
333
333
::: zone pivot="programming-language-csharp"
334
-
# [In-process](#tab/in-process)
334
+
###[In-process](#tab/in-process)
335
335
336
336
```csharp
337
337
[FunctionName("SayHello")]
@@ -352,7 +352,7 @@ public static string SayHello([ActivityTrigger] string name)
352
352
}
353
353
```
354
354
355
-
# [Isolated process](#tab/isolated-process)
355
+
###[Isolated process](#tab/isolated-process)
356
356
357
357
In the .NET-isolated worker, only serializable types representing your input are supported for the `[ActivityTrigger]`.
You can use regular input and output bindings in addition to the activity trigger binding.
430
430
431
431
::: zone pivot="programming-language-javascript"
432
-
For example, you can take the input to your activity binding, and send a message to an Event Hub using the Event Hubs output binding:
432
+
For example, you can take the input to your activity binding, and send a message to an event hub using the Event Hubs output binding:
433
433
434
434
```json
435
435
{
@@ -495,10 +495,10 @@ The durable client trigger is defined by the following JSON object in the `bindi
495
495
::: zone pivot="programming-language-python"
496
496
The way that you define a durable client trigger depends on your chosen programming model.
497
497
498
-
# [v2](#tab/python-v2)
498
+
###[v2](#tab/python-v2)
499
499
Using the `durable_client_input` decorator directly in your Python function code.
500
500
501
-
# [v1](#tab/python-v1)
501
+
###[v1](#tab/python-v1)
502
502
The durable client trigger is defined by the following JSON object in the `bindings` array of *function.json*:
503
503
504
504
```json
@@ -536,7 +536,7 @@ Here's an example queue-triggered function that starts a "HelloWorld" orchestrat
536
536
537
537
::: zone pivot="programming-language-csharp"
538
538
539
-
# [In-process](#tab/in-process)
539
+
####[In-process](#tab/in-process)
540
540
541
541
```csharp
542
542
[FunctionName("QueueStart")]
@@ -552,7 +552,7 @@ public static Task Run(
552
552
> [!NOTE]
553
553
> The previous C# code is for Durable Functions 2.x. For Durable Functions 1.x, you must use `OrchestrationClient` attribute instead of the `DurableClient` attribute, and you must use the `DurableOrchestrationClient` parameter type instead of `IDurableOrchestrationClient`. For more information about the differences between versions, see the [Durable Functions Versions](durable-functions-versions.md) article.
@@ -739,12 +739,12 @@ By default, the name of an entity is the name of the function.
739
739
> Entity triggers aren't yet supported for Java.
740
740
::: zone-end
741
741
::: zone pivot="programming-language-python"
742
-
The way that you define a entity trigger depends on your chosen programming model.
742
+
The way that you define an entity trigger depends on your chosen programming model.
743
743
744
-
# [v2](#tab/python-v2)
744
+
####[v2](#tab/python-v2)
745
745
Using the `entity_trigger` decorator directly in your Python function code.
746
746
747
-
# [v1](#tab/python-v1)
747
+
####[v1](#tab/python-v1)
748
748
The entity trigger is defined by the following JSON object in the `bindings` array of *function.json*:
749
749
750
750
```json
@@ -765,7 +765,7 @@ By default, the name of an entity is the name of the function.
765
765
766
766
Here are some notes about the entity trigger:
767
767
768
-
***Single-threaded**: A single dispatcher thread is used to process operations for a particular entity. If multiple messages are sent to a single entity concurrently, the operations will be processed one-at-a-time.
768
+
***Single-threaded**: A single dispatcher thread is used to process operations for a particular entity. If multiple messages are sent to a single entity concurrently, the operations are processed one-at-a-time.
769
769
***Poison-message handling** - There's no poison message support in entity triggers.
770
770
***Message visibility** - Entity trigger messages are dequeued and kept invisible for a configurable duration. The visibility of these messages is renewed automatically as long as the function app is running and healthy.
771
771
***Return values** - Entity functions don't support return values. There are specific APIs that can be used to save state or pass values back to orchestrations.
@@ -805,12 +805,12 @@ The entity client is defined by the following JSON object in the `bindings` arra
805
805
> In most cases, we recommend that you omit the optional properties and rely on the default behavior.
806
806
::: zone-end
807
807
::: zone pivot="programming-language-python"
808
-
The way that you define a entity client depends on your chosen programming model.
808
+
The way that you define an entity client depends on your chosen programming model.
809
809
810
-
# [v2](#tab/python-v2)
810
+
####[v2](#tab/python-v2)
811
811
Using the `durable_client_input` decorator directly in your Python function code.
812
812
813
-
# [v1](#tab/python-v1)
813
+
####[v1](#tab/python-v1)
814
814
The entity client is defined by the following JSON object in the `bindings` array of *function.json*:
0 commit comments