Calling Async Microflow from JavaAction fails

3
When I execute Async Microflows, my parameters are nullified. I need to run a few microflows in parallel. But I don't quite understand either the context of a JavaAction or the way parameters are passed to executeAsync methods, as these Microflows fail to execute. Why would this code execute the Microflow with correct parameters: ... private Long CombinedNumber; private String MicroFlowName; public BGMicroFlows(Long CombinedNumber, String MicroFlowName) { super(); this.CombinedNumber = CombinedNumber; this.MicroFlowName = MicroFlowName; } @Override public Boolean executeAction() throws Exception { // BEGIN USER CODE Map<String,Object> parameters = new HashMap<String, Object>(); Core.getLogger(this.toString()).info("Number is: " + CombinedNumber.toString()); parameters.put("Combined", new Long(CombinedNumber)); Core.execute(this.getContext(), this.MicroFlowName, parameters); return true; // END USER CODE } ... But this fails as the parameters being passed are ignored: ... private Long CombinedNumber; private String MicroFlowName; public BGMicroFlows(Long CombinedNumber, String MicroFlowName) { super(); this.CombinedNumber = CombinedNumber; this.MicroFlowName = MicroFlowName; } @Override public Boolean executeAction() throws Exception { // BEGIN USER CODE Map<String,Object> parameters = new HashMap<String, Object>(); Core.getLogger(this.toString()).info("Number is: " + CombinedNumber.toString()); parameters.put("Combined", new Long(CombinedNumber)); Core.executeAsync(this.getContext(), this.MicroFlowName, parameters); return true; // END USER CODE } ... ?
asked
4 answers
3

The executeAsync method you're referring to only accepts IMendixObject or IMendixIdentifier parameters for microflows (see the method documentation).

As a workaround you could call this method for a Java Action (for a Java Action other parameter types are accepted) and in this Java Action execute the microflow synchronously.

I think it's a good idea to add an executeAsync variant to the Core class which does accept other parameter types, could you perhaps file a ticket for this?

answered
0

Is probably running, but it is not able to interact with the user-interface. Change you check for changed data in the database?

answered
0

The signature of Core.execute is

(IContext context, String action, Map<String,Object> args)

however, the signature of Core.executeASync is

(IContext context, String action, Object... args)

So probably you should call your action like (never used Async from java)

Core.executeAsync(this.getContext(), this.MicroFlowName, new Long(CombinedNumber));

or

Core.executeAsync(this.getContext(), this.MicroFlowName, "Combined", new Long(CombinedNumber));
answered
0

When I run the code with execute, in debug my parameter shows up:

alt text

But, when I try all the permutations of the Async's signature, the Microflow is started without the parameter:

alt text

So, how would you run 2 web services simultaneously from a microflow? I'm trying Java code in a Java Action, but I'm sure somebody had to do something like this before in Mendix?

answered