Companion repository for the How to chain Azure Functions and leverage Durable Functions to reduce the burden when managing long-living serverless workloads blog post, addressing technical facets of microservices orchestration under the Microsoft Azure umbrella with Azure Functions and Durable Functions.
The blog post brings implementation details that hopefully will help developers thrive when working with the Function Chaining and Async HTTP APIs application patterns.
The dummy Funds Transfer App comprises 4 business steps, each of them implemented as an Azure Function:
Main characteristics:
-
get-funds-transfer-data
returns a value to the orchestrator; -
get-funds-transfer-data
,validate-input
, andhandle-funds-transfer
are mandatory and must run in this order; -
validate-internal-account
is optional can execute betweenvalidate-input
andhandle-funds-transfer
under certain conditions.
-
Create an Azure Function using the Azure Portal.
-
Clone this repo:
git clone https://github.com/ricardolsmendes/azure-durablefunctions-python.git
-
Publish the Azure Function:
cd azure-durablefunctions-python || exit func azure functionapp publish <YOUR-FUNCTION-NAME>
The HTTP URI will be displayed at the end of the publishing logs — replace
{functionName}
withtransfer-funds
. -
Use Postman or equivalent tool to make requests and see it in action. Please use the below content as a reference request body:
{ "metadata": { "requestId": "6d79dbfb", "requestType": "fundsTransfer" }, "data": { "sourceAccount": { "id": "123456", "bankId": "001" }, "targetAccount": { "id": "456789", "bankId": "002" } } }
This will result in successful execution. The validation errors and optional execution path can be activated by applying slight changes to it:
- remove
data
,data.sourceAccount
, ordata.targerAccount
to see the validation errors; - change
data.targetAccount.bankId
to001
to runvalidate-internal-account
in a given workflow.
- remove
Please make sure to take a moment and read the Code of Conduct.
Please report bugs and suggest features via the GitHub Issues.
Before opening an issue, search the tracker for possible duplicates. If you find a duplicate, please add a comment saying that you encountered the problem as well.
Please make sure to read the Contributing Guide before making a pull request.