WillD
WillD

Reputation: 6512

how can I terminate an orchestrator function in azure function app

It is possible to manually terminate an orchestrator function that is in the middle of running on an Azure function app.

"Stopping" or "Restarting" the function app doesn't seem to do it.

Do I use the CLI? Is there a way to do it from the browser-based portal?

Upvotes: 3

Views: 4112

Answers (2)

Gpack
Gpack

Reputation: 2193

For some reason, I also couldn't make the extension work but I found an API to terminate an azure function: https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-http-api#terminate-instance

In version 2.x or later of the Functions runtime:

POST /runtime/webhooks/durabletask/instances/{instanceId}/terminate
    ?taskHub={taskHub}
    &connection={connectionName}
    &code={systemKey}
    &reason={text}

Upvotes: 3

TLDR:

The most convenient way I have bumped into so far is Azure Durable Functions Monitor that can be used "as a VsCode extension, as a Standalone service or in Injected mode (installed as a NuGet package to your .Net Functions project)".

Explanation:

Durable Functions are holding the state of an orchestration in persistent storage behind the scenes (table storage by default), Orchestrator is not running constantly, but is starting multiple times throughout the whole process, picking up the state where it's left. Whenever you restart function app, the runtime invokes the orchestrator again, because it has a persisted state that says "hey, I've got some unfinished job to do!".

Upvotes: 2

Related Questions