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”.
CookWorkflow → startCooking
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?