This repo contains a .NET solution which is part of a blog post series about Azure Durable Functions. It also serves as demo material for some of my presentations and Youtube videos.
The solution consists of two projects:
- DurableFunctions.Demo.DotNetCore, a Function App targeted at .NET Core 2.1.
- DurableFunctions.Demo.DotNetCore.Test, an xUnit test project targeted at .NET Core 2.1.
The current version of this Function App depends on the free (and fun) external SWAPI in order to demonstrate function chaining and fan-out/fan-in patterns. This API doesn't require any authentication which makes it easier to demo and experiment with. The chaining and fan-out/fan-in functions can even run without any connection to the internet when the SkipRemoteSwapi
setting in local.settings.json is set to true
(it is then limited to using some hardcoded values).
The Function App solution consists of the following demos (found in seperate solution folders) which can be executed independently.
You can watch the Youtube video where I explain the functionality and source code.
This section contains the following functions to start orchestrations:
Run the solution and use the requests in Start.http and StartAndWait.http to learn how orchestrations can be started over HTTP and discover how the status or result is returned.
You can watch the Youtube video where I explain the functionality and source code.
This section contains the following functions to retrieve the status of orchestration instances:
Run the solution and use the requests in GetStatusForMany.http and GetStatusForOne.http to learn how to retrieve the status of orchestration instances.
You can watch the Youtube video where I explain the functionality and source code.
This section contains the following functions to purge orchestration instance history and to terminate an instance:
Run the solution and use the requests in PurgeHistoryForMany.http and PurgeHistoryForOne.http to learn how to purge the orchestration instance history. Use the request in TerminateInstance.http to learn how to stop a running instance.
You can watch the Youtube video where I explain the functionality and source code.
Shows how an orchestration function (HelloWorldOrchestrator
) calls an activity function (HelloWorldActivity
).
Run the solution and use the requests in HelloWorld.http to start the orchestration locally.
Shows how an orchestration function (HelloNameOrchestrator
) calls an activity function (HelloNameActivity
) and passing a some data to the activity.
Run the Function App locally and use the requests in HelloName.http to start the orchestration.
You can watch the Youtube video where I explain the functionality and source code.
This section shows how an orchestration function (GetCharacterInfoOrchestrator
) calls two activity functions in a chain (SearchCharacterActivity
-> GetPlanetActivity
).
The orchestration function requires a (partial) name of a Star Wars character. This character is searched in the SearchCharacter
activity which uses the swapi.co
API. When a character is returned the GetPlanet
activity is called (also uses swapi.co
again) to return the name of the home planet of the character. The full name of the character and the planet are returned from the orchestration.
Run the solution and use the requests in GetCharacterInfo.http to start the orchestration locally.
This sections shows how an orchestration function (GetPlanetResidentsOrchestrator
) calls activity functions using the fan-out/fan-in pattern (SearchPlanetActivity
-> n * GetCharacterActivity
).
The orchestration function requires a (partial) name of a Star Wars planet. This planet is searched in the SearchPlanetActivity
activity which uses the swapi.co
API. When a planet is returned the GetCharacterActivity
activity is called for each of the residents found in the SearchPlanet
result. The full name of the planet and the names of the planet residents are returned from the orchestration.
Run the solution and use the requests in GetPlanetResidents.http to start the orchestration locally.
Some unit tests are added to verify the fan-out/fan-in orchestration. These tests are using xUnit, Moq (for mocking the DurableOrchestrationContextBase
), AutoFixture for generating testdata and FluentAssertions for... right, the fluent assertions :).
I strongly recommend to the excellent REST client for VS Code so you can use the http files located in the api-tests
folder to start the orchestration functions.
Some of these are getting outdated now...
2017 - Azure Durable Functions - Stateful function orchestrations (part 1)
2017 - Azure Durable Functions - Stateful function orchestrations (part 2)
2017 - Durable Functions on YouTube (part 1)
2017 - Durable Functions on YouTube (part 2) - Eternal orchestrations & external events
2018 - Durable Functions on YouTube (part 3) - The Function Chaining Pattern
2018 - Durable Functions - The Anatomy of Function Naming
2019 - Discovering the Durable Functions API - DurableOrchestrationClient (part 1)
2019 - Discovering the Durable Functions API - DurableOrchestrationClient (part 2)
Feel free to leave questions or comments here as GitHub issues so I can keep track of them.