If I lost the terminate uri for an active Azure Durable function run, is there a way to recover it? I also don't have the instance id.
1
votes
2 Answers
1
votes
In case you don't have the instance ID of the orchestration you can first call this API of your deployed function app:
GET /runtime/webhooks/durableTask/instances?
taskHub={taskHub}
&code={systemKey}
&createdTimeFrom={timestamp}
&createdTimeTo={timestamp}
&runtimeStatus={runtimeStatus1,runtimeStatus2,...}
&showInput=[true|false]
&top={integer}
Where:
- The taskHub is the
hubName
value in the host.json (or a default, see https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-task-hubs?tabs=csharp). - The code is the master (or system) key of the function app.
- The timestamps are in this format
yyyy-MM-ddTHH:mm:ssZ
(e.g. 2020-02-01T00:00:00Z). - The runtimeStatus is one or more of this enum:
- Running = 0,
- Completed = 1,
- ContinuedAsNew = 2,
- Failed = 3,
- Canceled = 4,
- Terminated = 5,
- Pending = 6.
This returns a collection of orchestrations and one of these is the instance you want to terminate. Extract the instanceId and perform the following POST method to terminate the instance:
POST /runtime/webhooks/durabletask/instances/{instanceId}/terminate
?taskHub={taskHub}
&connection={connectionName}
&code={systemKey}
&reason={text}
1
votes
{
"id": "d3b72dddefce4e758d92f4d411567177",
"sendEventPostUri": "http://localhost:7071/runtime/webhooks/durabletask/instances/d3b72dddefce4e758d92f4d411567177/raiseEvent/{eventName}?taskHub={taskHub}&connection={connection}&code={systemKey}",
"statusQueryGetUri": "http://localhost:7071/runtime/webhooks/durabletask/instances/d3b72dddefce4e758d92f4d411567177?taskHub={taskHub}&connection={connection}&code={systemKey}",
"terminatePostUri": "http://localhost:7071/runtime/webhooks/durabletask/instances/d3b72dddefce4e758d92f4d411567177/terminate?reason={text}&taskHub={taskHub}&connection={connection}&code={systemKey}"
}
PS: get the ID from your Azure Table