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.


A follow up question on this.
I don’t want to add any dependency of service A or B on one another. Can calling a workflow of B from a workflow of A still be achieved?

You can have a service C that hosts workflow that calls A and B. In this case, there is no dependency between A and B.