简体   繁体   中英

C# - Azure Durable Function - Restart Orchestration

i'm working with durable functions. I have already understood how Durable Functions work, so it has an Orchestration that controls the Flow (the order that activities work), that orchestration takes care of the Sequence of the Activities.

But currently i am having a question that i'm not finding the correct answer and maybe you can help me on that:

Imagine that i have one orchestration, with 5 activities. One of the activities do a Call to an API that will get a Document as an Array of bytes.

If one of the activities fail, the orchestration can throw an exception and i can detect that through the code.

Also i have some retry options that Retry the activities with an interval of 2 minutes. But... What if those retries doesn't success?

As i was able to read, i can use "ContinueasNew" method in order to restart the orchestration, but there is a problem i think. If i use this method in order to restart the orchestration 1 hour after, will it resume the activity where it was?

I mean, if the first activity is done and when i restart the orchestration due to failure of one of the activities, will it resume on the 2nd activity as it was before?

Thank you for your time guys.

If you restart the orchestration, it doesn't have any state of the previous one. So the first activity will run again.

If you don't want that to happen, you'll need to retry the second one until it succeeds. I would not recommend making that infinite though, an orchestration should always finish at some point. I'd just increase the retry count to a sufficiently high number so I can be confident that the processing will succeed in at least 99% of cases. (How likely is your activity to fail?) Then if it still fails, you could send a message to a queue and have it trigger some alert. You could then start that one from the beginning. If something fails so many times that the retry amount is breached, there could be something wrong with the data itself and typically a manual intervention may be needed at that point.

Another option could be to send the alert from within the orchestration if the retries fail, and then wait for an external event to come from an admin who approves or denies it to retry.

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