# Is it possible to define a workflow with 2 activities that are bound to 2 workers respectively?

**URL:** <https://community.temporal.io/t/is-it-possible-to-define-a-workflow-with-2-activities-that-are-bound-to-2-workers-respectively/7879>\
**Category:** Community Support\
**Tags:** go-sdk, task-queue, worker\
**Created:** [April 12, 2023, 8:20am UTC](https://community.temporal.io/t/is-it-possible-to-define-a-workflow-with-2-activities-that-are-bound-to-2-workers-respectively/7879 "2023-04-12T08:20:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![stgt](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/stgt/32/3620_2.png) [@stgt](https://community.temporal.io/u/stgt)\
**Post date:** [April 12, 2023, 8:20am UTC](https://community.temporal.io/t/is-it-possible-to-define-a-workflow-with-2-activities-that-are-bound-to-2-workers-respectively/7879/1 "2023-04-12T08:20:07Z")

</div>

I’ve confirmed that a workflow can specify a task queue by using ActivityOptions and creating a new context for each activity invocation.

As per the title, I’m thinking of whether I can define a workflow with 2 activities that are bound to 2 workers respectively.

When running the worker/main.go like the following, it initiates only w1. Apparently, it’s due to worker.InterruptCh() as the argument of the Run function.

```auto
func main() {
	c, err := client.Dial(client.Options{})
	if err != nil {
		log.Fatalln("Unable to create client", err)
	}
	defer c.Close()

	w1 := worker.New(c, MyTaskQueue1, worker.Options{})
	w2 := worker.New(c, MyTaskQueue2, worker.Options{})

	w1.RegisterWorkflow(MyWorkflow)
	w1.RegisterActivity(MyActivity1)
	w2.RegisterActivity(MyActivity2)

	err = w1.Run(worker.InterruptCh())
	if err != nil {
		log.Fatal("Unable to start worker", err)
	}

	err = w2.Run(worker.InterruptCh())
	if err != nil {
		log.Fatal("Unable to start worker", err)
	}

```

Apparently, a worker executes tasks so having multiple workers help execute tasks faster if tasks are enormous. For example, a workflow that spawns child workflows with many activities. Going back to my question, Is it possible to define a workflow with 2 activities that are bound to 2 workers respectively?

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [April 12, 2023, 3:44pm UTC](https://community.temporal.io/t/is-it-possible-to-define-a-workflow-with-2-activities-that-are-bound-to-2-workers-respectively/7879/2 "2023-04-12T15:44:13Z")

</div>

You can either use `Worker.Start` instead of `Worker.Run` or call `Worker.Run` for each worker in its own goroutine.

> Apparently, a worker executes tasks so having multiple workers help execute tasks faster if tasks are enormous.

I don’t think this is necessarily true. Multiple workers and queues allow specifying different parallelism and rate limits per queue. But I would recommend starting from a single worker and only going to multiple if you start running into performance issues.
