Java | Durable Functions
This quickstart demonstrates Durable Functions with Java using the Durable Task Scheduler backend. It includes two patterns:
- Function Chaining — An orchestration that calls three "say hello" activities sequentially for different cities
- Fan-out/Fan-in — An orchestration that greets multiple cities in parallel and aggregates the results
- Java 11+ (JDK)
- Maven
- Azure Functions Core Tools v4
- Docker (for the DTS emulator and Azurite)
-
Start the Durable Task Scheduler emulator:
docker run --name dtsemulator -d -p 8080:8080 -p 8082:8082 mcr.microsoft.com/dts/dts-emulator:latest
-
Start Azurite for Azure Functions host storage:
docker run --name azurite -d -p 10000:10000 -p 10001:10001 -p 10002:10002 mcr.microsoft.com/azure-storage/azurite
-
Build the sample:
cd samples/durable-functions/java/HelloCities mvn clean package -
Run the Functions host:
mvn azure-functions:run
-
Trigger the function chaining orchestration:
curl -X POST http://localhost:7071/api/StartChaining
-
Trigger the fan-out/fan-in orchestration:
curl -X POST http://localhost:7071/api/StartFanOutFanIn
-
View in the dashboard: http://localhost:8082
mvn clean packageis configured to stage the Azure Functions app somvn azure-functions:runworks as a separate second step.AzureWebJobsStorage=UseDevelopmentStorage=truerequires Azurite to be running locally.DURABLE_TASK_SCHEDULER_CONNECTION_STRINGinlocal.settings.jsonpoints to the local DTS emulator onhttp://localhost:8080.
The chaining orchestration greets Tokyo, Seattle, and London sequentially:
Hello Tokyo! Hello Seattle! Hello London!
The fan-out/fan-in orchestration greets all three cities in parallel and returns aggregated results.