I have a workflow that should select and start new workflows from the End listener’s notify() method.
In order to start the new workflow I am using the RuntimeService’s startProcessInstanceByKey() method but the started workflow does not finish.
It seems that the second workflow hangs after the first one finishes. I have listener callbacks for the transition take events for all transitions in the first workflow but I have the same callback for just the first transition on the second workflow. The second workflow contains a 1 minute timer only.
Is this method of starting a new workflow correct? How can I debug the second workflow using logger configuration?
check out the attached processes. Simply deploy them on your testing engine, start an instance of process “first” and wait a minute. You will see process instance of “first” exiting very quickly, while 3 instances of “second” will survive until timer is reached and then exit. Is that what you wanted to build?
The example only uses JavaScript, of course you can (and maybe should) use Java.
BTW, if you start other process instances out of a process, I would always suggest to use messages and the corresponding symbols. That makes the diagrams better to read. Sure, the send message event needs some kind of coding behind, but the reader can faster understand what is happening.
If your problem cannot be solved by checking my example, please provide some example that shows the non-working situation. first.bpmn (6.5 KB) second.bpmn (4.2 KB)
I figured out that the problem was not in the java code that starts another workflow but with the second workflow’s timer element. If I remove the timer from the second workflow then I have no issues with workflow execution. I think that the timer does not continue execution after the configured time duration has expired.
I don’t see any difference with timer definition from your sample workflow. Can you please check attached workflow?firstPartition.bpmn (3.1 KB)
How can I debug the timer problem?