Currently I am trying to execute some activities in workflow by Async.function.
List<Promise> listOfPromise = new ArrayList();
listOfPromise.add(Async.function(account::consume, dto).thenApply((m)->{
saga.addCompensation(account::refund, dto);
return null;
}));
// .....
finalResult = Promise.allOf(listOfPromise.toArray(new Promise [listOfPromise.size()]));
finalResult.cancellableGet();
How can I wait until all activities tasks get completed (whatever failed and successes ).