This is very straight forward situation where my first workflow sets up some values and second workflow uses those values to do something. My problem is 1st workflow takes time to set up those values and second workflow is unable to get the values 1st workflow sets up. How can I make sure to wait till 1st Workflow is completed before invoking second. Below is my code, It is doing the trick but I am not sure if thats the right way.
while (wfSession.getWorkflows(new String[] { "RUNNING" }).length != 0) {
LOG.info("Waiting to Finish");
}
In above solution I am getting count of workflow associated with current session with status Running. once its zero I exit the loop. My concern is what if workflow keeps in running state due to an error or any other thing.