Class BaseSubscriptionListener

java.lang.Object
com.caplin.datasource.subscription.BaseSubscriptionListener
All Implemented Interfaces:
SubscriptionListener

public class BaseSubscriptionListener extends Object implements SubscriptionListener

A base implementation of SubscriptionListener that can be used to easily provide SubscriptionListener implementations without the need to override every method. This class can be extended in order to override only the methods a particular Subscription is interested in as an alternative to implementing every method in SubscriptionListener.

 

It is highly recommended that you extend this class rather than directly implementing the SubscriptionListener interface as this class will log warnings if callbacks occur upon methods you have not overridden. This is preferable to the simple empty implementations of an 'adapter' class where unexpected callbacks upon methods you have not overridden can go unnoticed and are difficult to trace.

  • Field Details

    • logger

      protected final Logger logger
      Provides protected access to the logger that was passed to the constructor.
  • Constructor Details

    • BaseSubscriptionListener

      public BaseSubscriptionListener(Logger logger)
      Creates a BaseSubscriptionListener that uses the provided Logger to log warnings about callbacks made on methods that have not been overridden.
      Parameters:
      logger - The Logger that warning messages are logged to.
  • Method Details

    • containerUpdated

      public void containerUpdated(Subscription subscription, Peer peer, ContainerMessage containerMessage)
      Description copied from interface: SubscriptionListener

      Called when a container update is received.

      Specified by:
      containerUpdated in interface SubscriptionListener
      Parameters:
      subscription - The subscription for which the update occurred.
      peer - The DataSource peer supplying the update.
      containerMessage - The container update.

       

      The operations on the ContainerMessage are not normalized; therefore the message may contain contradictory operations, for example an add for an element followed by a delete for the same element.

    • newsUpdated

      public void newsUpdated(Subscription subscription, Peer peer, NewsMessage newsMessage)
      Description copied from interface: SubscriptionListener

      Called when a news headline update is received.

      Specified by:
      newsUpdated in interface SubscriptionListener
      Parameters:
      subscription - The subscription for which the update occurred.
      peer - The DataSource peer supplying the update.
      newsMessage - The news update.
    • pageUpdated

      public void pageUpdated(Subscription subscription, Peer peer, PageMessage pageMessage)
      Description copied from interface: SubscriptionListener

      Called when a page update is received.

      Specified by:
      pageUpdated in interface SubscriptionListener
      Parameters:
      subscription - The subscription for which the update occurred.
      peer - The DataSource peer supplying the update.
      pageMessage - The page update.
    • permissionUpdated

      public void permissionUpdated(Subscription subscription, Peer peer, PermissionMessage permissionMessage)
      Description copied from interface: SubscriptionListener

      Called when when a permission update is received.

      Specified by:
      permissionUpdated in interface SubscriptionListener
      Parameters:
      subscription - The subscription for which the update occurred.
      peer - The DataSource peer supplying the update.
      permissionMessage - The permission update.
    • recordType2Updated

      public void recordType2Updated(Subscription subscription, Peer peer, RecordType2Message recordType2Message)
      Description copied from interface: SubscriptionListener

      Called when an update to type 2 data in a record is received.

      Specified by:
      recordType2Updated in interface SubscriptionListener
      Parameters:
      subscription - The subscription for which the update occurred.
      peer - The DataSource peer supplying the update.
      recordType2Message - The record update.
    • recordType3Updated

      public void recordType3Updated(Subscription subscription, Peer peer, RecordType3Message recordType3Message)
      Description copied from interface: SubscriptionListener

      Called when an update to type 3 data in a record is received.

      Specified by:
      recordType3Updated in interface SubscriptionListener
      Parameters:
      subscription - The subscription for which the update occurred.
      peer - The DataSource peer supplying the update.
      recordType3Message - The record update.
    • recordUpdated

      public void recordUpdated(Subscription subscription, Peer peer, RecordMessage recordMessage)
      Description copied from interface: SubscriptionListener

      Called when an update to type 1 data in a record is received.

      Specified by:
      recordUpdated in interface SubscriptionListener
      Parameters:
      subscription - The subscription for which the update occurred.
      peer - The DataSource peer supplying the update.
      recordMessage - The record update.
    • storyUpdated

      public void storyUpdated(Subscription subscription, Peer peer, StoryMessage storyMessage)
      Description copied from interface: SubscriptionListener

      Called when a story update is received.

      Specified by:
      storyUpdated in interface SubscriptionListener
      Parameters:
      subscription - The subscription for which the update occurred.
      peer - The DataSource peer supplying the update.
      storyMessage - The story update.
    • subjectErrorReceived

      public void subjectErrorReceived(Subscription subscription, Peer peer, SubjectErrorEvent subjectErrorEvent)
      Description copied from interface: SubscriptionListener

      Called when there is an error in a subscription.

      Specified by:
      subjectErrorReceived in interface SubscriptionListener
      Parameters:
      subscription - The subscription for which the error occurred.
      peer - The DataSource peer that sent this subscription error.
      subjectErrorEvent - The subscription error.
    • subjectStatusReceived

      public void subjectStatusReceived(Subscription subscription, Peer peer, SubjectStatusEvent subjectStatusEvent)
      Description copied from interface: SubscriptionListener

      Called when there is a change in the status of a subscription.

      Specified by:
      subjectStatusReceived in interface SubscriptionListener
      Parameters:
      subscription - The subscription for which the status change occurred.
      peer - The DataSource peer that sent this change in subscription status.
      subjectStatusEvent - The subscription status event.
    • genericMessageUpdated

      public void genericMessageUpdated(Subscription subscription, Peer peer, GenericMessage message)
      Description copied from interface: SubscriptionListener

      Called when an update to generic message data is received.

      Specified by:
      genericMessageUpdated in interface SubscriptionListener
      Parameters:
      subscription - The subscription for which the update occurred.
      peer - The DataSource peer supplying the update.
      message - The record update.
    • jsonUpdated

      public void jsonUpdated(Subscription subscription, Peer peer, JsonMessage message)
      Description copied from interface: SubscriptionListener

      Called when an update to json message data is received.

      Specified by:
      jsonUpdated in interface SubscriptionListener
      Parameters:
      subscription - The subscription for which the update occurred.
      peer - The DataSource peer supplying the update.
      message - The json update.