Event chaining and event handlers

Some event handlers support invocation of APIs. These APIs can retrieve more data pertinent to the event being raised, or they may direct to perform a business computation or transaction. In turn, the transaction can raise other events, thus resulting in event chaining.

For example, one of the event handlers for the ORDER_CREATE event can check the validity of an order and call an API to HOLD the order. This results in the triggering of the HOLD event, which sends an e-mail message to a customer service representative. Event chaining provides an extensibility mechanism that is required for complex business processing.

Important: Actions that are configured to be invoked by the ON_FAILURE event must not perform any database updates. Any database updates performed by an action invoked by the ON_FAILURE event is rolled back.

To access the data published by , you must implement the YFSEventHandlerEx() interface, which provides the handleEvent() function to implement as follows:

public boolean handleEvent (YFSEnvironment oEnv, String sTranID, String
 sActionCode, Map sKeyData, int iDataType, Object sData, String sShipNode,
 String [] parms) throws Exception 
Important: While it is possible to implement an API that causes an event that is associated with an action in the application to call the same API, take care to avoid this situation. It creates an infinite loop.

The class name must be configured as the Java™ object on the Action Configuration screen in the transaction configuration.

All the parameters for the handleEvent() function are input parameters, with values inserted by the application. The last parameter in this function is the parms parameter, which is an array of String constants. The values of these string constants are the values of the string constants specified after the class name during the action configuration in the application.

Note: For details on the YFSEventHandlerEx interface, see the Javadoc.