This example demonstrates stateful resilience patterns in a REST environment. A payment (micro-)service can retrieve payments if called via REST. It requires an upstream REST service to charge credit cards.
This simple call-chain is great to demonstrate various important resilience patterns.
See introduction for the storyline / patterns behind
- .NET Core 2.0
- C#
- Polly 5.8.x
- Camunda 7.x
The first step is to run Camunda itself. You have two options:
- Donwload, unzip and run, see: https://camunda.com/download/
- Docker:
docker run -d -p 8080:8080 camunda/camunda-bpm-platform:latest
See also Use Camunda without touching Java and get an easy-to-use REST-based orchestration and workflow engine for more details on this.
Hint: This project uses the unsupported Camunda Client Sample for C# available as NuGet Package: BerndRuecker.Sample.CamundaClient. This clients does the low level Camunda REST API handling and provides a proper C# API. However, it is just a sample developed for a showcase and not supported in any way.
In order to run the flowing-retail/rest example:
- Create a new solution in Visual Studio
- Add the FlowingRetailPayment project (this folder)
- Fix the dependency of FlowingRetailPayment to Camunda Client Sample for C#
- Add the StripeFake project
- Configure your solution for multiple start projects
- Make sure you run the projects via the .NET CLI, see launchSettings.json commandName usage
Now the different versions of the payment service are available:
You now can issue a PUT with an empty body:
curl \
-H "Content-Type: application/json" \
-X PUT \
-d '{}' \
http://localhost:8100/api/payment/v1
For Camunda there is an enterprise edition available with additional features in Cockpit (the monitoring tool). It is quite handy to use this when playing around with the example. You can easily switch to use enterprise edition:
- Download and get a trial license if you don't have a license yet: https://camunda.com/download/enterprise/
Note that you do not need the enterprise edition to run the examples, the community edition will also do fine. But because of less features you do not see historical workflow instances - and that means you do not see that much in Camunda Cockpit if everything runs smoothly.