One Workflow Interface with multiple workflow Implementations

Hey Team,

I have a requirement where there’s only one @WorkflowInterface CookWorkflow with one @WorkflowMethod which is startCooking(String foodName).

I have n number of implementation of the CookWorkflow interface and only one worker. All the implementations are registered to the same worker and after consuming an event from a kafka topic, based on the event I need to “startCooking”.

interface :
CookWorkflow → startCooking

implementations:
MyCooking implements CookWorkflow
GrandmasCooking implements CookWorkflow
ChefSpecialCooking implements CookWorkflow

To start cooking I need to choose one implementation of the CookWorkflow.

 CookWorkflow workflow = client.newWorkflowStub(CookWorkflow.class, options);

Since a workflowStub can be created only with the interface type, is there a way to choose any one of the implementations during runtime?

@maxim @tihomir Can any workflow be triggered using the workflow implementation name ?

Thanks
vishal

How does the worker is expected to choose the concrete implementation?

Hi @maxim

I currently do not have a way to choose the implementation.

Is there any way to call the workflow with the workflow impl name during application runtime dynamically ? - it would be great if we could somehow do it with the name… :partying_face:

Also, I would love to hear your ideas for the above use case.

Thanks,
Vishal

What is the reason for having a single workflow type? Why can’t you use the supported approach?

CookWorkflow workflow = client.newWorkflowStub(MyCookingImpl.class, options);

Did you read the relevant section of the documentation?