No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
api-tests
src
.gitignore
LICENSE
README.md

README.md

demos-azure-durable-functions

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.

Solution

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).

Demos

The Function App solution consists of the following demos (found in seperate solution folders) which can be executed independently.

01-Basics

HelloWorld

Shows how an orchestration function (HelloWorld) calls an activity function (HelloWorldActivity).

Run the solution and use the requests in HelloWorld.http to start the orchestration locally.

HelloName

Shows how an orchestration function (HelloName) 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.

02-Chaining

Shows how an orchestration function (GetCharacterInfo) calls two activity functions in a chain (SearchCharacter -> GetPlanet).

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.

03-FanOutFanIn

Shows how an orchestration function (GetPlanetResidents) calls activity functions using the fan-out/fan-in pattern (SearchPlanet -> n * GetCharacter).

The orchestration function requires a (partial) name of a Star Wars planet. This planet is searched in the SearchPlanet activity which uses the swapi.co API. When a planet is returned the GetCharacter 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.

Unit tests

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 :).

Using the VS Code REST Client

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.

My blog posts & videos with more info about Durable Functions.

Some of these are getting outdated now...

Azure Durable Functions - Stateful function orchestrations (part 1)

Azure Durable Functions - Stateful function orchestrations (part 2)

Durable Functions on YouTube (part 1)

Durable Functions on YouTube (part 2) - Eternal orchestrations & external events

Durable Functions on YouTube (part 3) - The Function Chaining Pattern

Questions

Feel free to leave questions or comments here as GitHub issues so I can keep track of them.