Complete Parent workflow, once ChildWorkflow is scheduled/started

I want my parent workflow to call a long running child workflow asynchronously.
I want to keep it untype (for future flexibility). so here is what I am doing as per docs

        val childUntyped = Workflow.newUntypedChildWorkflowStub(
            workflowType,
            ChildWorkflowOptions.newBuilder()
                .setWorkflowId(workflowId)
                .setTaskQueue(taskQueue)
                .setParentClosePolicy(ParentClosePolicy.PARENT_CLOSE_POLICY_ABANDON)
                .build()
        )
     
        val childExecution = childUntyped.executeAsync(
            Unit.javaClass,
            definition
        )
        // Important:This is to ensure that a Child Workflow Execution starts before the parent closes.
        // If the parent initiates a Child Workflow Execution and then completes immediately after,
        // the Child Workflow will never execute. Refer: https://docs.temporal.io/application-development/features?lang=java#parent-close-policy
        childExecution.get()

        log.info("Successfully Scheduled Child workflow")

both workflows are kicked off.

  • child workflow has a timer and is still running.

  • I expected the parent workflow to complete after the child workflow has started. but I see it is still waiting for the promise - childExecution.get()

I am not sure why the promise is not returned after child has started?

ChildWorkflowStub.executeAsync returns a Promise that becomes ready when a child workflow completes. Use ChildWorkflowStub.getExecution() to get a Promise that becomes ready when the child workflow starts.