3 Code Configuration

API for Raising an Event:

For raising an event, generateEvent API has been provided in the AbstractApplication class. A developer needs to call this API to generate an alert that is required for the respective business logic

It takes three parameters:

  1. Session Context
  2. ActivityLog: This object contains the dynamic data that needs to be replace in place of attributes in the message template content.
  3. EventId

Typically, an event is triggered from service after the business logic has been performed. While triggering alert API event id and the parameters that needs to be passed should be determined and defined to the database tables mentioned above.

For an account-based alert of type mandatory or subscription, accountId and accountType attribute should be populated in ActivityLog. Similarly for a Party-based alert, customerId attribute should be populated in the ActivityLog.

In the application, Activity log contains some basic fields that can be used as attributes for the alert processing. In case, additional fields are required in the message content a sub class of ActivityLog should be created and used and passed as an argument to “generateEvent” API.

Following is a sample code that can be used in the business logic to generate and event and trigger alert.

ActivityLog activityLog = new ActivityLog();
            activityLog.setCustomerId(sessionContext.getTransactingPartyCode());            
            activityLog.setAccountId(“<<AccountNumber>>”);            
            activityLog.setAccountType(“<<AccountType>>”);
            //If required, set other attributes in activityLog      
    super.generateEvent(sessionContext, activityLog, <<EventId>>);

Alert generated using schedulers, listener classes

An alert can be generated from a non-standard REST API of OBDX application. It can be invoked in a scheduler class, a listener class or it can also be invoked from a runnable thread invoked within a service. In such cases, ensure that following code is executed at the end of the business logic. Possibly within a finally block of the code, through which generate event has been triggered.

EmHandler.getInstance().putMessage();