Reuse Activities across workflows

Is it ok to re-use activities across multiple workflows? As I understand although task queue name is same while registering workflow & activities with the worker, separate task queues get created for activities & workflow.

Yes, absolutely. Activities are registered with a task queue, so any workflow that schedules an activity using that task queue can invoke it. The current requirement is that the activity and workflow belong to the same namespace.

Oh interesting, so if new workflows have to re-use an existing activity, those workflows have to schedule that activity using the same task queue with which the activity was originally created?

Also wondering what happens if we invoke same activity with a different task queue from each workflow(assuming same namespace)

Oh interesting, so if new workflows have to re-use an existing activity, those workflows have to schedule that activity using the same task queue with which the activity was originally created?

There is no concept of “originally created” in Temporal. At any moment of time workers listen on any number of queues. Each worker listens on a queue has some activities and workflows registered.

To invoke an activity use the same task queue name as the worker that hosts that activity listens on.

1 Like

Correct. I meant same task queue name. Thanks