M3 ideas


Home | Pages | Archives


Java code in Event Analytics rules

April 28, 2015 6:02 pm

To add custom Java code to a Drools rule in Event Analytics in the Infor Grid:

  1. Write your Java code, compile it, and archive it to a JAR file:
    // javac thibaud\HelloWorld.java
    // jar cvf HelloWorld.jar thibaud\HelloWorld.class
    package thibaud;
    public class HelloWorld {
        public static String hello(String CUNO) {
            return "Hello, " + CUNO;
        }
    }
    

  2. Find the host of Event Analytics as explained here, copy/paste the JAR file to the application’s lib folder in the Infor Grid, and restart the application to load the JAR file:

    4_
  3. Write the Drools Rule that makes use of your Java code, reload the rules, and test:
    5
    6_

Thank you.

Posted by thibaudatwork

Categories: Event Hub, Event Analytics

Tags: , ,

5 Responses to “Java code in Event Analytics rules”

  1. UPDATE: In the section “then”, we can use event.getElementValue(“CUNO”)

    Like

    By thibaudatwork on May 11, 2015 at 12:28 pm

  2. Hello Thibaud. Interesting post. Trying to figure out how it works but i am confused. I set up a rule (MPLIND, create record during PPS300) in analytics to post an event if PUOS=50 only.
    If i put a system.out.println(event.getElementValue(“PUOS”)) in the rule, i see the debug line only for PO receipt in MPLIND status 50.

    Then i set up MEC as a suscriber in the partner admin (M3:MPLIND:C::P2).

    As a result, MEC receives 100% of events, regardless the status of the line added in MPLIND. If i do a receipt for a PO with direct put-away (status 75 immediately), an xml file is sent to MEC.

    Where am i wrong ? How can we setup MEC to receive only events filtered by analytics ?

    Thank you!

    Like

    By maxric on November 10, 2015 at 1:25 am

    1. Bonjour Maxime. Supposing your Event Analytics rule does event.postEvent ("Maxime"), then your MEC you should subscribe to EventAnalytics:Maxime (not M3:MPLIND) — Thibaud

      Like

      By thibaudatwork on November 10, 2015 at 10:39 am

  3. Excellent it works ! Thank you.

    Liked by 1 person

    By maxric on November 16, 2015 at 12:54 am

  4. […] Java code in Event Analytics rules […]

    Like

    By Site map – M3 ideas on May 9, 2017 at 12:22 pm

Leave a Reply



Mobile Site | Full Site


Get a free blog at WordPress.com Theme: WordPress Mobile Edition by Alex King.