Best practice for handling lost external events and resuming paused workflows

This code is deterministic. During replay the activity doesn’t need to rerun as its result is recorded in the workflow execution history. So thenApply still runs.

1 Like

@maxim @antonio.perez One more doubt since we are setting done inside lambda it needs to be AtmoicBoolean. So there won’t be any issues using AtmoicBoolean inside temporal workflows ??

AtomicBoolean is OK as it never blocks.

1 Like

@maxim We implemented our use case using infrequent polling, and everything worked as expected. Now, after moving that activity to run in parallel, we noticed a new issue: even if the workflow completes through a signal, resumes, and then finishes successfully, the parallel activity still remains listed under “Pending Activities.”.

  1. So ideally that activity should be completed right if workflow is COMPLETED ??
  2. Also if this is expected then should we cancel it explicitly. if yes how ??
  3. or wait for next retry to happen. Also if we wait for next retry will it cause any issues (any side effects)??

An activity is considered canceled when the workflow completes. So it will not be retried after that. The UI view shows its state at the point of workflow closure.

1 Like