MyListener.java

This sample code for the listener class not only shows the single onEvent(EventObject) method that the listener must implement, but it also shows what data you can get from the EventObject.

import javax.jms.IllegalStateException;

import com.jdedwards.base.datatypes.JDECalendar;
import com.jdedwards.system.connector.dynamic.SystemException;
import com.jdedwards.system.connector.dynamic.newevents.EventListener;
import com.jdedwards.system.connector.dynamic.newevents.EventObject;

Sample implementation of a Java Connector Asynchronous Event SessionListener.

public class MyListener implements EventListener {

Permits the listener to receive an event when it has been delivered from the Transaction Server.

@param event the event

public void onEvent(EventObject event) {
        

Do some processing here with the event that is sent by the Transaction Server. The onEvent(EventObject) method is called once for every event that is delivered.

*The event category: "RTE", "XAPI", or "ZFILE".

String category = event.getCategory();
        

The event type, such as "RTSOOUT".

String type     = event.getType();
        

The JD Edwards EnterpriseOne environment in which the event was generated.

String environment = event.getEnvironment();

The global sequence number of the event.

long sequenceNumber = event.getSequenceNumber();

The date and time stamp of the event.

JDECalendar date = event.getDateTime();

The XML content of the event as a single String object.*/

String xmlPayload = event.getXMLPayload();

If you created an EventSession with CLIENT_ACKNOWLEDGE mode, you must acknowledge each message you receive. Otherwise the event will be redelivered according to the Transaction Server JMS Provider's logic.

             try {
            
            event.acknowledge();
            
        } catch (IllegalStateException e) {
            

This Exception will be thrown if the session associated with this event has already been closed.

    } catch (SystemException e) {
            

This Exception will be thrown if the original event could not be acknowledged (duplicate event delivery is likely in this scenario).

       }
   }
}