Example Code for Event Registration and Subscription Start - EnterWorks_Process_Exchange_(EPX) - 10.6

EnterWorks EPX Programmers Reference

Product type
Software
Portfolio
Verify
Product family
EnterWorks
Product
Precisely EnterWorks > EnterWorks Process Exchange (EPX)
Version
10.6
Language
English
Product name
Precisely EnterWorks
Title
EnterWorks EPX Programmers Reference
Topic type
Programming Reference
Reference
First publish date
2007

In this example, the server profile is set to the server that the example is logged into and the event registration is defined as all generic transaction events and any event related to a change in the state of the EPX server.

public void startEventConsumer() throws EventException

{

// define the server to listen for events on

setEventsServerProfile(this.getServerProfile());

// define the events of interest for this event consumer

EventRegistration eventReg = new EventRegistration();

// listen for generic transaction events

eventReg.addEventFilter(

EventRegistration.SUBJECT_GENERIC_TRANSACTION, EventRegistration.FILTER_OBJECT_IDENTIFIER,

"%",

EventRegistration.ASPECT_ANY );

// listen for server start-up and shutdown

eventReg.addEventFilter(

EventRegistration.SUBJECT_SERVER,

EventRegistration.FILTER_UNIQUE_IDENTIFIER,

this.getServerProfile().getUID(),

EventRegistration.ASPECT_STARTUP );

eventReg.addEventFilter(

EventRegistration.SUBJECT_SERVER,

EventRegistration.FILTER_UNIQUE_IDENTIFIER,

this.getServerProfile().getUID(),

EventRegistration.ASPECT_SHUTDOWN );

eventReg.addEventFilter(

EventRegistration.SUBJECT_SERVER,

EventRegistration.FILTER_UNIQUE_IDENTIFIER,

this.getServerProfile().getUID(),

EventRegistration.ASPECT_UPDATE );

// associate the event registration with the consumer

setEventRegistration(eventReg);

// define a name for the consumer

setConsumerName("EventExample");

// start listening for events

start();

String vargs[] = { this.getServerProfile().getUID() };

System.out.println(getMessage("event.start",vargs));

}