Same workflow interface multiple implementations (using Java SDK)

Hey Team!

Is it recommended to have the same workflow interface implemented differently in 2 or more implementation classes, and register these implementations to different workers/queues?

One use case I am dealing with is to execute the same task in different cloud providers… For code organization representing these tasks as the same type of workflow would be preferable. I think this means I need to start a new queue/worker for each cloud provider to make sure the right implementation is picked up…

Using different task queues would work in this case.

Another option is two define two different activity types extending the same common interface. Then the workflow would instantiate a different type depending on the cloud provider. But the calling code wouldn’t be aware of the specific type as it would be using the super interface.

Here is the sample of the polymorphic activity.

Hi, is there a more graceful way to implement the function?

I need to add all implementations of the activity with the method: registerActivitiesImplementations if there are many implementations of an activity.

I don’t understand the question. May be there is a more graceful way, but I’m not aware of it.