Writing a subscriber class

Write a subscriber class based on the subscriber reference code that is provided, or create your own class that extends the AbstractSubscriber class.

About this task

Your subscriber class must meet the following requirements:
  • Extend the AbstractSubscriber class.
  • Contain a no-arg constructor.
  • Implement the release() method. This method is called to signal your code to terminate.
    Note: The release() method is called from a different thread than the main execution thread. Follow the pattern in the sample where release() sets a class variable.

Procedure

To write a subscriber class:

  1. Add code to the reference subscriber that retrieves data from the remote system you are connecting to. See Subscriber class template for reference subscriber source code.
  2. Add the subscriber class Javadoc to your Eclipse development environment.
    1. Right-click the project_name and select Build path > Configure build path.
    2. Click the Libraries tab.
    3. If CounterFraud_Common.jar is not already in the classpath, add it.
    4. Expand the CounterFraud_Common.jar node.
    5. Select Javadoc location and click Edit.
    6. Add CounterFraud_Common.jar as the archive that contains the Javadoc.
  3. Create a Counter Fraud event with an event type corresponding to the data the subscriber received from the remote system. Set the Counter Fraud event type either directly, or optionally by using the subscribe framework's investigation to event mapping capability. Using investigation to event mapping allows your code to change mappings without changing Java code.
  4. The AbstractSubscriber base class provides a number of helper methods. Use code helpers to complete the following steps:
    • Get the mapping from the external investigation stereotype to the Counter Fraud event stereotype: getExternalAlertStereotypeToCounterFraudStereotypeMap();
    • Map an external investigation stereotype to a Counter Fraud event stereotype and send the event: processNotification( Event event, String external_alert_stereotype );
    • Get the configured initialization string for the subscriber class instance: getInitializationString();

    The subscriber framework calls the run() call helper method for your classes to start the execution thread. See the AbstractSubscriber base class for a complete list of helper methods.