Hello @Benedikt Schmitt,
To gracefully terminate an eternal orchestration in Azure Durable Functions, you can use the terminate API of the orchestration client binding. This allows you to stop the orchestration while ensuring that all currently processing messages are completed before the orchestration halts.
Here is a general approach to implement this using an HTTP trigger:
- Store the Orchestration ID: When you start your eternal orchestration, make sure to store the orchestration ID somewhere accessible, such as in a database or in-memory storage.
- Implement the HTTP Trigger: Create an HTTP-triggered function that will handle the termination request. This function should retrieve the stored orchestration ID.
- Call the Terminate API: Use the terminate method on the orchestration client to stop the orchestration. You can provide an optional reason for termination, but this is not necessary for a graceful stop.
- Graceful Processing: The orchestration will continue to process any messages it is currently handling until they are completed, but it will not check for new messages after the terminate call.
For further clarification, please refer to the following documentations:
- Eternal orchestrations in Durable Functions (Azure Functions)
- Handling errors in Durable Functions (Azure Functions)
I hope this helps resolve your issue. Feel free to reach out if you have further concerns.