Reputation: 352
I've got a durable function C# app with the pattern of an HTTP trigger, an orchestrator, and a workflow of several functions that the orchestrator runs. When running, however, I see some unexpected output in the console though that I can't explain.
As you can see in the screenshot above, the trigger (green annotation) fires once (as expected), the orchestrator (red annotations) appears to fire five times (unexpected), but the workflow functions (yellow annotations) appear to only fire once (as expected).
As the multiple orchestrator executions don't appear to be executing the workflow multiple times, this is probably less of a problem and more of a quirk, possibly with the console output (maybe it doesn't fully support durable functions yet?). Still, it would be good to know if that is what's actually happening!
Has anyone else encountered this behaviour, and/or does anyone understand and can explain what's happening?
Thanks!
Upvotes: 1
Views: 786
Reputation: 609
Durable functions maintain state of execution for orchestrator in storage.
So when you call an activity(say activity1), orchestrator stops executing and once activity is completed, orchestrator is triggered again.
Now orchestrator starts again and tries triggering activity1 again, but it knows from state that activity was already triggered and result of the activity, so it skips execution of activity and moves to next step.
This way an orchestrator runs multiple times but each activity is ran only once.
This is also the reason it is recommended to not perform any computation in orchestrator otherwise it will run it multiple times.
Upvotes: 5