.NET | Durable Task SDK
Demonstrates eternal orchestrations using the Durable Task SDK. An orchestration that runs indefinitely by periodically performing work and restarting itself with ContinueAsNew, which clears its history to prevent unbounded growth.
This pattern is useful for:
- Periodic data cleanup or aggregation
- Heartbeat or health-check monitoring
- Background jobs that run on a schedule
- Any long-running loop that must survive restarts
- .NET 8 SDK
- Docker (for the emulator)
-
Start the Durable Task Scheduler emulator:
docker run -d -p 8080:8080 -p 8082:8082 mcr.microsoft.com/dts/dts-emulator:latest
-
Start the worker (in one terminal):
cd Worker dotnet run -
Start the client (in another terminal):
cd Client dotnet run -
View the eternal orchestration in the dashboard: http://localhost:8082
- The orchestration performs a cleanup task (simulated)
- It logs the iteration count and result
- It waits using a durable timer (e.g., 10 seconds)
- It calls
ContinueAsNewwith an incremented counter, which restarts the orchestration with a clean history - This loop continues indefinitely until explicitly terminated