Suppose in the workflow there is an activity “A” that can fail due to various factors in the external system. The default retry behavior in temporal is to re-run A in configurable intervals. What if I want to decide what to do upon A run into failure dynamically?
For example, if activity A fails due to reason X, I want to retry A at a later time. If A fails due to reason Y, I want to start a new activity B next. If A fails due to reason Z, I want to do something else etc.
I guess the most straightforward approach to implement this dynamic retry is to put some if/else if code in the workflow based on the result of A’s previous run. This just feels too cumbersome. Is there any better way to do it in temporal? Does temporal offer any utility for this?
Thanks