Skip to content
main
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 

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.

00-Starters

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.

01-Status

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.

02-Maintenance

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.

10-Basics

You can watch the Youtube video where I explain the functionality and source code.

HelloWorld

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.

HelloName

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.

20-Chaining

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.

30-FanOutFanIn

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.

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

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)

Questions

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

About

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.

Topics

Resources

License

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.