Search code examples
cadence-workflowtemporal-workflow

Uber Cadence Local Activity Vs Side Effect


What are some key differences between Local Activities and Side Effect? On the surface both of them appear to be similar where Local Activity is a super set. When should user prefer Side Effect over Local Activity.


Solution

  • SideEffect doesn't support any error handling. If it fails it essentially blocks the workflow execution (by panicing the decision task). It is also executed in the same goroutine as the workflow code.

    LocalActivity is executed in a separate goroutine and supports error handling including automatic retries through RetryOptions.

    So use SideEffect only for very short lived operations that are not expected to fail. Or if they fail it is OK to block the workflow execution. UUID generation is a good example of such operation.