graph LR
HttpStart{{"#32;HttpStart"}}:::function
style HttpStart fill:#D9D9FF,stroke-width:2px
HttpStart.httpTrigger>"#127760; http:[get,post]"]:::httpTrigger --> HttpStart
TestRestApiMethod{{"#32;TestRestApiMethod"}}:::function
style TestRestApiMethod fill:#D9D9FF,stroke-width:2px
TestRestApiMethod.httpTrigger>"#127760; http:[get]"]:::httpTrigger --> TestRestApiMethod
MapReduceOrchestrator[["#32;MapReduceOrchestrator"]]:::orchestrator
style MapReduceOrchestrator fill:#D9D9FF,stroke-width:2px
HttpStart ---> MapReduceOrchestrator
MapReduceOrchestrator -- "[ContinueAsNew]" --> MapReduceOrchestrator
ProcessingActivity[/"#32;ProcessingActivity"/]:::activity
style ProcessingActivity fill:#D9D9FF,stroke-width:2px
MapReduceOrchestrator ---> ProcessingActivity
Demonstrates how to:
- Implement map/reduce scenarios with Azure Durable Functions.
- Run an eternal orchestration, that perpetually restarts itself, passing some data that resulted from previous execution as input.
- Clone this repo.
- In the project's folder create a
local.settings.json
file, which should look like this:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "your-azure-storage-connection-string",
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
}
}
- Go to the project's folder with your command prompt and type the following:
func start
- Navigate to http://localhost:7071/api/HttpStart
This will start a singleton orchestration instance, which will proceed with executing some parallel activities, then sleep for a while and then restart itself. Invoking http://localhost:7071/api/HttpStart again will forcibly restart this orchestration (cancel all current execution history and start the process again).
Note, that because this is a singleton orchestration, there is no need to implement any periodic storage cleanup.
Also note this setting in host.json file:
"extensions": {
"durableTask": {
"overridableExistingInstanceStates": 0
}
}
This is essential for enabling the orchestration to be forcibly restarted (by default, StartNewAsync()
method throws an exception if an instance with given id already exists).
Once up and running, you can monitor the orchestration's status with Durable Functions Monitor: