-1

My intention is to have a ParentWorkflow launch an independent ChildWorkflow and then NOT wait for the child to finish. When I launch the ChildWorkflow directly from the ParentWorkflow, however, I find that I cannot get this behavior -- the parent always waits for the child. You can set what happens to the child if the parent terminates (cancel, abandon, terminate) but you can't "disconnect" the child from the parent.

I figured a good way to be able to do this is to start an activity LaunchChildWorkflowActivity that will then spawn the child workflow. However, a test run has caused this error to appear:

No context found. It means that the method is called outside of the workflow definition code.

The stack trace indicates that in the LaunchChildWorkflowActivity, calling ChildWorkflowClientFactory.getClient() eventually leads to a getDecisionContext() call which is not allowed in an Activity. So now I'm not sure how to proceed.

One idea is to get the ChildWorkflowClient in the ParentWorkflow, and pass it into LaunchChildWorkflowActivity.launchChild, but I'm not sure that's the best idea since SWF has limitations on the size of objects that can be passed from context to context like this.

(The reason I'm trying to make this work is that I want the logic in the ChildWorkflow be its own indepentent lightweight unit that can be retried alone without having to invoke the ParentWorkflow, which contains rather expensive operations.)

Pomacanthidae
  • 207
  • 1
  • 3
  • 8
  • Please show the relevant code and state the exact problem or error. A description alone is not enough. Also see [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). – jww Dec 21 '19 at 04:39

1 Answers1

0

ChildWorkflowClientFactory can be used only from a workflow code. As you are starting workflow from an activity it should use normal client that is used from any external code.

Maxim Fateev
  • 6,458
  • 3
  • 20
  • 35