Pages

Contact

Call M3 API from Event Analytics rules

Here is how to call M3 API from a Drools rule in Infor Event Analytics; this is a common requirement.

Sample scenario

Here is my sample business case.

When a user changes the status of an approval line in OIS115 (OOAPRO), I have to find the order type (ORTP) of the order to determine which approval flow to trigger in Infor Process Automation (IPA), but ORTP is not part of the table OOAPRO, for that reason I must previously make a call to OIS100MI.GetHead.

I could call M3 in the approval flow, but false positives would generate noise in the WorkUnits.

Is it possible?

I asked Nichlas Karlsson, Senior Architect – Business Integration at Infor, if it was possible to call M3 API directly in the Drools rule. He is one of the original developers of Event Hub and Event Analytics and very helpful with my projects (thank you) although he does not work with these products any longer. He responded that Event Analytics is a generic software with no specific connection to M3, so unfortunately this is not possible out of the box, however it is a common requirement. He said I could solve it using MvxSockJ to call M3 APIs in my own Java class, included in a jar that I put in the lib folder. He added to not forget that the execution time for all rules within a session must be less than the proxy timeout, i.e. 30s. And I would also need to manage host, port, user, password and other properties in some way.

Instead of MvxSockJ I will use the MI-WS proxy of the Grid as illustrated in my previous post.

Hallo Janne. Thank you. Yes, I thought about using REST but then like MvxSockJ you would need to store/retrieve the host/port and establish socket connections which the proxy abstracts and provides a connection pool.

Hi Veena. Thank you. I do not work with MAK (I stay away from it). My personal understanding is that you do not simply do SQL/JDBC from an M3 program as M3 has better built-in abstractions for it; but I am no MAK person. Ask your question in one of the forums; see the Links page for the list (try Potato IT forums, Infor Guru, IT Toolbox), https://thibaudatwork.wordpress.com/links/ . /Thibaud

M3 does have built-in features to read/update/delete data sequentially. However, I couldn’t anything which will return me count. I already put my question on potatoit, I will definately post it on infor guru and it toolbox.

Thanks for this article.
Is it possible to browse all getElementValue (“xxx”) after the “then”. In fact, what I want to do is trigger the API only if one of the elementValue is different from oldElementValue. Do you have an idea.

Yes you can, it’s a Java data structure like any other. For example elementValues[“x”] != elementOldValues[“x”]. Check the data structure’s type in the imports, introspect it, and use its methods. All standard Java. Also, check the JBoss Drools documentation.

In that case, one of the JAR files is missing or changed, or you have the wrong code. Go to the Event Analytics application properties page on the Infor Grid, and find the classpath with all the JAR files. Then go to the folders on the server and find those JAR files. Then use a disassembler like JD-GUI and open those JAR files. Then see what you have in package com.lawson.eventhub and introspect the classes. See if the event class has a method getElements and with what types. Then share the solution with us here. Hope it helps. –Thibaud

Do you mean inside a Drools Rule in Event Analytics? Probably yes, it’s Java so technically you can do whatever. But I wouldn’t do it unless I knew the potential implications on the rest of Event Hub/Analytics or lack thereof (I don’t know either). Currently your official options are M3 Enterprise Collaborator (MEC), Infor Process Automation (IPA) and ION. Try faking a 60s timeout with java.Thread.sleep(60000) on a frequent event and see what happens.