简体   繁体   中英

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?

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.".

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}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM