I do this in quite a few projects. You cannot do this in Mendix, so you need to revert to Java. I created a custom Java action called ExecuteMicroflowInParallel. It has the following inputs:
* microflowName: String
* inputName: String
* objectList: List of AnyObject
(Aditionally, you could add String/Object pairs if your microflows require more objects. Add these to your parameters hashmap)
Then, use the following Java code
// BEGIN USER CODE
List<Future<Object>> futures = new ArrayList<Future<Object>>();
HashMap<String, Object> parameters = new HashMap<String,Object>();
IContext context = this.getContext();
for (IMendixObject object : objectList) {
parameters.put(inputName, object);
Future<Object> future = Core.executeAsync(context, microflowName, true, parameters);
futures.add(future);
parameters.clear();
}
for (Future<Object> future : futures) {
future.get();
}
return true;
// END USER CODE
The result is parallel execution of microflows, which only continues once all calls have completed.
Obviously, you will have to rewrite the code if you want to call *different* microflows. I would suggest a list of objects which contain microflowNames strings. Then, loop over them and call the microflow in the string.
Furthermore, if you are concerned about stability, you could validate empty values and if the microflow actually exists with a call like Core.getMicroflowNames().contains(microflowName).
I think the process queue can be a solution but you have to implement a timer on the user's interface to check if the webservice calls are finished.
I would worry if it's really a good idea to do this (maybe both calls are in fact handled by the same process in the external system, and it won't help at all).
If you're sure it is a good idea to do this it can be done. But be aware that concurrency is Hard. I would try to find a light weight Java library that provides specifically what you're looking for (trigger two threads at once, continue when both have finished).