cadence-workflowtemporal-workflowuber-cadence

Iterative activity in Cadence / Temporal workflow


This can be considered a follow-up question to Invoking the same activity inside a loop in cadence workflow: How does the workflow recover in case of activity iteration ? Will is continue invoking the i-th activity (skipping the ones that were already invoked) or start again from 0 ? If so, how can the workflow be written so that activities that were invoked (0-'k') are skipped ?


Solution

  • First of all, it's important to understand the difference between workflow worker vs activity worker.

    Coming back to your question: When your "workflow" worker crashes, restarts, lost or somehow a worker received a decision task that it doesn't know about its workflow; it will then request the history of that workflow from Cadence servers. It will replay the workflow until is consumes the whole history it receives then will schedule the next activity based on current local variables.

    So it will continue from the same loop iteration with the same local variables and parameters to the activity.

    Hope this answers your question