Activity method invocation within workflow signal method

Hi Temporal team,

If we call an activity method inside a workflow signal method, would it behave similarly (failures are retried) as if the activity method were called inside a workflow method?

Is it bad practice to call an activity method within a workflow signal method? I suppose signal method should be for simple logic such as changing state?

Thanks,
Richard

If we call an activity method inside a workflow signal method, would it behave similarly (failures are retried) as if the activity method were called inside a workflow method?

Yes, activity invoked from the signal method behaves exactly the same from the service point of view.

Is it bad practice to call an activity method within a workflow signal method? I suppose signal method should be for simple logic such as changing state?

It is not black and white. But in the majority of cases, I find that calling activities from the main workflow thread leads to more understandable and maintainable code. For example, do you know that if a signal thread is blocked on an activity and another signal is received then the signal handler will be still called in another thread? This potentially can lead to a very large number of threads used by a workflow.

1 Like