Interface SubscriptionListener


public interface SubscriptionListener

The listener interface for receiving update and object deletion events for a particular subscription. A class that is interested in receiving these events must implement this interface.

The listener object that is created with a class that implements this interface should be registered using the Subscriber.addSubscriptionListener(java.lang.String, com.caplin.transformer.module.SubscriptionListener) method. When an update for a subscribed object occurs, the update method will be invoked. When a subscribed object is deleted from the Transformer, the objectDeleted method will be invoked.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    objectDeleted(String objectName)
    Invoked when an object the listener is subscribed to is deleted.
    void
    status(String objectName, ObjectStatus status)
    Invoked when the status of one of the objects this listener is subscribed to changes.
    void
    Invoked when an object the listener is subscribed to is updated.
  • Method Details

    • objectDeleted

      void objectDeleted(String objectName)

      Invoked when an object the listener is subscribed to is deleted. The name of the object that has been deleted is passed through as an argument.

      If the deleted object name matches the subscription name (i.e. an exact object name was requested instead of an object name pattern), then the subscription will be removed.

      If the listener has been registered for multiple subscriptions it could be called multiple times for the same object deletion. For example, if the listener was subscribed to the object name patterns /??/VOD and /LO/*, and by type for records, then the deleteObject method would be invoked three times if the record /LO/VOD was deleted.

      Parameters:
      objectName - The name of the object that has been deleted.
    • update

      void update(DataSourceUpdateEvent event)

      Invoked when an object the listener is subscribed to is updated. Information about the data can be obtained from the event parameter.

      The TransformerData obtained from the event will only contain fields that have been updated. If a field that is not part of the update is required, it can be obtained from the Transformer core's cache using DataCache.get(String).

      If the listener has been registered for multiple subscriptions it could be called multiple times for the same update. For example, if the listener was subscribed to the object name patterns /??/VOD and /LO/*, and by type for records, then the update method would be invoked three times when an update for the record /LO/VOD was received.

      Parameters:
      event - The object that contains all the information about the update.
    • status

      void status(String objectName, ObjectStatus status)

      Invoked when the status of one of the objects this listener is subscribed to changes. This will be because one of the required and/or non-required DataSources providing the data for the object has gone up or down.

      Parameters:
      objectName - The subject that this status message applies to.
      status - The status of the object.