Is it possible to separate the workflow registration and activity registration to separate processes?

Primarily i want all workflow registrations to happen from a single place, but i want to split the activity execution across multiple jvms. I am also looking at reuse the workers /activity across multiple workflows.

so i am looking at doing something like below, is this a valid usage?

JVM1: (processes only activity 1,3 and 5)
worker = temporalFactory.newWorker(“fooTaskList”);
worker.registerActivitiesImplementations(new object{activitity1,activitiy3,activity5});
//no workflow registration here…

JVM2: (does activity2,4 and 6 alone)
worker = temporalFactory.newWorker(“fooTaskList”);
worker.registerActivitiesImplementations(new object{activitity2,activitiy4,activity6});
//no workflow registration here too…

JVM 3: all workflow registration happens from here
(may be no activity registration here)…
worker.registerWorkflowImplementationTypes(new Class[wf1,wf2,wf3,wf4]));
wf1,2,3 and 4 could be sharing all the activities.

1 Like

This will not work well because the workers in different VMS rely on the same task list but on different activity implementations. This means it is possible for a worker to pull an activity which it cannot handle(say JVM1 pulls activity 2). Either use separate task lists for the workers or have each worker register all activity implementations.

This is not a production-grade doc but its something in progress which could help:

1 Like

thanks @ryland :slight_smile:

1 Like

Anytime. Glad it helped

@ryland I have my workflow and my activities both registered on the same task list at the moment, but deployed in separate binaries: a workflow worker binary and an activities worker binary.

Is this allowed? I mean, does this result in the workflow worker not able to process activity-related messages from the common task list and vice versa?

My set up has been working fine but on a low volume of workflows and activities. I might have had pure luck so far.

It does work because activity and workflow task queues are completely independent even if they have the same name. I would still recommend avoiding such setup as it is not obvious when you have two sets of workers with the same name.

For clarity, I recommend using a different task queue name for each pool of worker processes independently if they host activities or workflows.

2 Likes