How to call an activity from other activity?

Sometimes we need to call some other service B from the activity of service A (A->B). It would be nice to have the activity at service B and call the activity from service A (A->activity B), having the retries, backpressure, etc by Temporal. As far as I assume, there is no way to run an activity without a workflow. So we need to have a workflow - wrapper for the activity at service B and call the workflow wrapper (A->workflow->activity B). Is it the right way? Is there an alternative?

All the features like retries, backpressure, etc are provided at the workflow level. So without a large architecture change it is not possible to support them for direct activity to activity calls.

So the solution is to not have activities calling other activities, but always call them from workflows. In the majority of the situations having activities that perform atomic unit of work that doesn’t depend on other activities leads to a more maintainable and simpler applications.

In your case you might have a workflow that calls A and then B with the result of A as an input.

2 Likes