Does childWorkflow inherit parents workflow options?


I have a workflow that creates child workflows. Would the child workflow inherit the same workflow options that the parent workflow uses. For example, namespace? If not, how would you pass in the namespace into the child workflow? In my case, I have different configuration based on the environment i’m running my worker against.

It looks like the only visible option is to pass it through the workflow method since we can’t pass parameters through the Workflow constructors

if you use

newChildWorkflowStub(java.lang.Class workflowInterface)

it will use the same workflow options as the parent workflow

you can specify custom ChildWorkflowOptions via

newChildWorkflowStub(java.lang.Class workflowInterface, ChildWorkflowOptions options)

So for your question, you could do for namespace, for example:

ChildWorkflowOptions childWorkflowOptions = ChildWorkflowOptions.newBuilder()
MyChildWorkflow myWorkflow = Workflow.newChildWorkflowStub(MyChildWorkflow.class, childWorkflowOptions);

Hope this helps