Custom Process Starters
The Java Event Source process starter allows you to create a custom process starter based on Java code that you create. You may need to create a custom process starter if you wish to do special processing of incoming events before starting a process or if you wish to receive events not currently supported by ActiveMatrix BusinessWorks.
The Java Event Source provides the features of other process starters without the need to write extra code. For example, your process starter can take advantage of the Sequencing Key field on the Misc tab without having to write the logic into your Java code.
The Java Event Source resource provides an abstract class that you must extend to create a process starter. The abstract class describes the methods that interact with the process engine. Your code must provide an implementation for the following methods:
|
•
|
init() — this method is called when the process engine starts. This method can initialize any resource connections. Alternatively, you could specify a Java Global Instance on the Advanced tab that initializes resource connections. Java Global Instances are loaded and initalized during process engine start up. You can call this.getJavaGlobalInstance() to obtain the Java Global Instance resource in your process starter code. |
|
•
|
onStart() — this method is called by the process engine to activate the process starter. This method must activate any event notifier or resource observer code. The notifier or observer code can then call the onEvent() method to start a process instance. |
|
•
|
onStop() — this method is called by the process engine to deactivate the process starter. This method must deactivate any event notifier or resource observer code. |
|
•
|
onShutdown() — this method is called by the process engine when the engine shuts down. This method should release any resources and resource connections and perform any required clean up operations. |
The following methods are already implemented and can be used in your code:
|
•
|
onEvent(Object object) — this method is called when a listener or resource observer catches a new event. The input to this method is a Java object containing the event data. |
|
•
|
getGlobalInstance() — this method returns an object reference to the Java Global Resource specified on the Advanced tab of the process starter. This is useful if you wish to place initialization code or other shared information in a Java Global Resource instead of in the init() method of this class. |
|
•
|
onError() — this method throws the exception specified in the input parameter. Use this method to propagate an error to the ActiveMatrix BusinessWorks process instance when a listener or resource observer fails to generate an event. |
For more information about creating and using a Java Event Source process starter, see TIBCO ActiveMatrix BusinessWorks™ Palette Reference.