Complete example program - 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
Last edition
2023-07-28
Last publish date
2023-09-20T04:07:07.148709

The example program will register for a collection of different types of events in the system, and pause for a configurable amount of time before exiting. If the applicable event notifications are received during this paused period, the example program will print out some detail about each event notification. In order to demonstrate the program, you can run the LoginExample, the WorkItemExample, or use Design Console to edit some objects. In addition to the default program parameters specified in the LoginExample program, the EventExample program has the following arguments:

  • -delay — the amount of time in seconds that the program will pause and wait for event notifications. The parameters defaults to 600 seconds, which is five (5) minutes.

For example:

C:\Enterworks\EPX\examples\api\run.bat EventExample

-server EPX_somehost -user system -password system

-delay 600

public static void main(String args[]) throws Exception

{

try

{

String serverUID = null;

String user = "system";

String password = "system";

String delayString = null;

String startDateString = null;

String endDateString = null;

String completedString = null;

for ( int i=0 ; i < args.length; i++)

{

String arg = args[i];

if (arg.startsWith("-"))

{

if (arg.substring(1).equals("server"))

serverUID = args[++i];

else if (arg.substring(1).equals("user"))

user = args[++i];

else if (arg.substring(1).equals("password"))

password = args[++i];

else if (arg.substring(1).equals("delay"))

delayString = args[++i];

}

}

// default delay to 5 minutes

long delay = 300000L;

// get the number of seconds to wait for events

// and convent to milliseconds

if ( delayString != null )

delay = Long.parseLong(delayString) * 1000L;

// create a new work item purge example and login

EventExample eventExample;

eventExample =

new EventExample(serverUID,user,password);

// login

eventExample.login();

// register for and listen for events

eventExample.startEventConsumer();

// have the program sleep for the specified delay

// and either run the work item example or use the

// Design Console so that events are generated

// for this program to handle

Thread.sleep(delay);

// after sleeping stop listening for events and log out

eventExample.stopEventConsumer();

eventExample.logout();

}

catch( Exception e )

{

System.err.println (

"EventExample.main(exception):" + e );

e.printStackTrace();

}

}