We have a Workflow that creates a child workflow, and retrieves the result of some operation. We now want to add a different implementation of that child workflow and create one or the other depending on some criteria in the main workflow. Up until now it is looking like this
@WorkflowInterface
public interface ChildWorkflow {
@WorkflowMethod
Result doSomeOperation(...);
}
public class ChildWorkflowImpl implements ChildWorkflow {
@Override
public Result doSomeOperation(...) {
...
}
}
@WorkflowInterface
public interface MainWorkflow {
@WorkflowMethod
void submit(SomeParams params);
}
public class MainWorkflowImpl implements MainWorkflow {
@Override
public void submit(final SomeParams params) {
final var childWorkflowOptions = ChildWorkflowOptions.newBuilder()...build();
final var childWorkflow = Workflow.newChildWorkflowStub(ChildWorkflow.class, childWorkflowOptions);
final Result result = childWorkflow.doSomeOperation(...);
}
}
What we want is to have several implementations for ChildWorkflow and decide which one to use from the MainWorkflow, to be able to doSomeOperation
regardless of the implementation, is this possible?
Looking at the last part of this section of the documentation, it doesn’t look promising, we might have to find some other way around it. But, am I missing something?
Thank you!