• Adi Jaradat

Maximo Events Explained

Updated: Feb 25

This post is a follow up to Maximo AppService Explained post. In the AppService post we mentioned that it is possible to register a listener for events.

In this post we will dive into Maximo Events and understand then inside-out.


What are Maximo Events


Maximo Event is a “signal” generated by Maximo objects and MBOs in response to some condition, upon receipt of which a listener may in turn take some action. An event is similar to database trigger, in some ways, and to Publish-Subscribe design pattern in most ways. They are used to notify the listeners of a particular event.


When an event is fired, registered event listeners get invoked in order to take action. With every event, an Event Message is passed along allowing the listener to obtain the MBO generating the event.


Event Types


Data Change Events


Those are events fired whenever MBO data is changed. There are three types of event here:

  1. add (lower case)

  2. delete (lower case)

  3. update (lower case)


Status Change Events


Applies for "Stateful" MBOs, upon changing status a Status Change event is fired. The event follows the following pattern:

maximo.MBO.statuschange.status 

For example, to get all Work Order events, the following event name shall be used:

maximo.workorder.statuschange.* 

To get PO APPR status change event, the following event name can be used:

maximo.po.statuschange.appr 

Keep in mind that all event names here are in lower case.


Miscellaneous Events


Those are specific events which may not be as useful for general development as the previous two. Examples are, changes in Cron Task Manager cache:

maximo.cache.maxprop.mxe.cronTaskMonitorInterval
maximo.cache.maxprop.mxe.cronTaskInitDelay
maximo.cache.maxprop.mxe.crontask.donotrun
maximo.cache.maxprop.mxe.crontask.historycleanuprate 

Or Workflow events:

maximo.wfinstance.* 


Register a new Event


To create a new event, you will need to select a meaningful name for the event and validate the event while passing the object generating the event as shown below:

String name = "maximo.myobject.myevent";
MXServer.getEventTopicTree().eventValidate(name, new EventMessage(name, this)); 


Listen to Events


To be able to listen to events you must implement a listener and register your listener with a specific event name.

To register your listener to an event

MXServer.getEventTopicTree().register("maximo.object.event", myListener); 

To implement a listener you must implement the Event Listener interface in psdi.server.event package. The code below explains the different functions of the Event Listener.

public abstract interface EventListener {
        public abstract boolean eventValidate(EventMessage paramEventMessage)
        throws MXException;
        // return true if you want to respond
 
        public abstract void preSaveEventAction(EventMessage paramEventMessage)
        throws MXException;
        // take action before saving the changes
 
        public abstract void eventAction(EventMessage paramEventMessage)
        throws MXException;
        // take the action, example:
        //     LabTrans labtrans = (LabTrans)em.getEventObject();
 
        public abstract void postCommitEventAction(EventMessage paramEventMessage)
        throws MXException;
        // take action after changes are committed
}
  

Links

https://adijaradat.com/post/maximo-appservice-explained/

https://developer.ibm.com/static/site-id/155/maximodev/7609/maximocore/businessobjects/psdi/server/event/EventListener.html

8 views0 comments
 
  • LinkedIn
  • Twitter

©2021 by Adi Jaradat.