-
Notifications
You must be signed in to change notification settings - Fork 271
Out of Proc Orchestrator Execution Schema Reference
Out-of-proc orchestrator functions, such as those that run in Node.js, communicate with the Functions host process and the Durable Functions extension by consuming a provided execution history and returning information about the orchestrator execution. If you are developing a library to write orchestrator functions in a language that the Azure Functions host runs out-of-proc (ex. JavaScript/Node.js), an orchestrator execution's return value must conform to this schema.
A library's API should have parity with the DurableOrchestrationContext in .NET. However, not all methods may make sense for the language you are writing the library in. For example, generic overloads such as CallActivityAsync(String, Object) are less at home in a loosely-typed language such as JavaScript.
Also consider the naming conventions of your target language. The -Async suffix is a C# convention to indicate a method that returns an instance of .NET's Task class, but JavaScript does not have this practice. Thus, the JavaScript library's version of CallActivityAsync
is callActivity
.
This schema will be added to as new features are introduced to Durable Functions.
The following sample JSON shows a sample execution result. All fields are required.
{
"isDone": false,
"actions": [
[
{
"actionType": 0,
"functionName": "E4_SendSmsChallenge",
"input": "+14562345678"
}
],
[
{
"actionType": 5,
"fireAt": "2018-04-24T01:12:01.083Z",
"isCanceled": false
},
{
"actionType": "waitForExternalEvent",
"externalEventName": "SmsChallengeResponse"
}
]
],
"output": null,
"customStatus": "Reticulating splines.."
}
The following sections of this article explain each top-level property.
Specifies whether this is the last execution of this orchestrator instance. When this value is true
, the Durable Functions extension will consider the orchestration instance completed and will attempt to return the output
value.
{
"isDone": false
}
An ordered list of async actions the orchestrator function should perform. This list is append-only; it must contain all scheduled async actions up to the latest requested work, even actions that have already been completed.
Actions are grouped by execution. Each subsequent orchestrator execution should add a new array of action objects to the collection.
{
"actions": [
[
{
"actionType": 0,
"functionName": "E4_SendSmsChallenge",
"input": "+14562345678"
}
],
[
{
"actionType": 5,
"fireAt": "2018-04-24T01:12:01.083Z",
"isCanceled": false
},
{
"actionType": "waitForExternalEvent",
"externalEventName": "SmsChallengeResponse"
}
]
]
}
Property | Description |
---|---|
actionType | The type of action to perform; e.g. CallActivityAsync |
externalEventName | The name of the event to wait for. |
fireAt | The time at which the timer should expire. |
functionName | The name of the orchestrator or activity function to run. |
input | The JSON-serializable input to pass to the orchestrator or activity function. |
instanceId | A custom instance ID (if any) a sub-orchestrator should be instantiated with. |
isCanceled | CreateTimer action only. Whether the timer has been canceled. |
retryOptions | The RetryOptions for an orchestrator or activity function call. |
Action Type | Accepted Values | Required Fields |
---|---|---|
Call Activity |
0 , "callActivity"
|
actionType, functionName, input |
Call Activity with Retry |
1 , "callActivityWithRetry"
|
actionType, functionName, retryOptions, input |
Call Sub-Orchestrator |
2 , "callSubOrchestrator"
|
actionType, functionName, instanceId, input |
Call Sub-Orchestrator with Retry |
3 , "callSubOrchestratorWithRetry"
|
actionType, functionName, retryOptions, input, instanceId |
ContinueAsNew |
4 , "continueAsNew"
|
actionType, input |
Create Timer |
5 , "createTimer"
|
actionType, fireAt, isCanceled |
Wait for External Event |
6 , "waitForExternalEvent"
|
actionType, externalEventName |
Optional. The JSON-serializable value returned by the orchestrator instance on completing execution.
{
"output": true
}
Optional. The JSON-serializable value set by a call to DurableOrchestrationContext.SetCustomStatus.
{
"customStatus": {
"splines": "reticulated",
"references": "dated"
}
}
Optional. The stack trace of an unhandled exception thrown by the orchestrator.