Microflow in Mendix

0
Hi All, I am writing a JMS connector for app2app communication. Publisher publishes and consumer(java action)  receives message. I am invoking microflow in the consumer java action, but the parameters are being ignored. I am getting empty value for parameter in microflow. Map<String,String> map = new LinkedHashMap<>(); map.put("xmlResponse", xmlResponse); logger.info("message is: "+xmlResponse ); Core.execute(getContext().getSession().createContext(), config.getMicroflowName(), map); I have used execute and executeAsync , both did not work.  Also used, getContext() , Core.createSystemContext() to get the IContect object, but that also did not fix.  microflow getting invoked but parameter is being ignored. Let me know what I am doing wrong. In the microflow, first checks whether parameter is empty or not, convert to object and commit it.  
asked
2 answers
1

There are some things I see which might be a problem:

1. Instead of

getContext().getSession().createContext()

  you can just use

getContext()

2. According to the documentation the Core.execute methods takes a HashMap<String, Object> as input parameter, so it may help if you change the type of your HashMap. Since String is an object anyway, the rest of your code shouldn't need refactoring.

3. Finally, you can just create a normal HashMap, instead of a LinkedHashMap.

 

Your final code should look something like:

 

HashMap<String,Object> params = new HashMap<String, Object>();
params.put("xmlResponse", xmlResponse);
logger.info("message is: "+xmlResponse );
Core.execute(getContext(), config.getMicroflowName(), params);

 

answered
0

Thanks Rom, It worked. It took nearly half day to identify this. 

answered