Interface SubscriptionListener

  • All Known Implementing Classes:
    BaseSubscriptionListener

    public interface SubscriptionListener

    The SubscriptionListener interface allows applications to receive events raised for a Subscription.

     

    Implement this interface to receive subscription events. You must implement all the callback methods; there is one for each subject type (Record, Page, News, and so on). Alternatively, you can derive your SubscriptionListener implementation from the BaseSubscriptionListener class and then override the methods corresponding to the subject types for which you want to handle events.

     

    Note:: the SubscriptionListener methods are not called on a dedicated worker thread. Therefore, if any of these methods are likely take a relatively long time to execute, they should be coded to run in a separate thread.

    • Method Detail

      • recordUpdated

        void recordUpdated​(Subscription subscription,
                           Peer peer,
                           RecordMessage message)

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

        Parameters:
        subscription - The subscription for which the update occurred.
        peer - The DataSource peer supplying the update.
        message - The record update.
      • recordType2Updated

        void recordType2Updated​(Subscription subscription,
                                Peer peer,
                                RecordType2Message message)

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

        Parameters:
        subscription - The subscription for which the update occurred.
        peer - The DataSource peer supplying the update.
        message - The record update.
      • recordType3Updated

        void recordType3Updated​(Subscription subscription,
                                Peer peer,
                                RecordType3Message message)

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

        Parameters:
        subscription - The subscription for which the update occurred.
        peer - The DataSource peer supplying the update.
        message - The record update.
      • genericMessageUpdated

        void genericMessageUpdated​(Subscription subscription,
                                   Peer peer,
                                   GenericMessage message)

        Called when an update to generic message data is received.

        Parameters:
        subscription - The subscription for which the update occurred.
        peer - The DataSource peer supplying the update.
        message - The record update.
      • jsonUpdated

        void jsonUpdated​(Subscription subscription,
                         Peer peer,
                         JsonMessage message)

        Called when an update to json message data is received.

        Parameters:
        subscription - The subscription for which the update occurred.
        peer - The DataSource peer supplying the update.
        message - The json update.
      • permissionUpdated

        void permissionUpdated​(Subscription subscription,
                               Peer peer,
                               PermissionMessage message)

        Called when when a permission update is received.

        Parameters:
        subscription - The subscription for which the update occurred.
        peer - The DataSource peer supplying the update.
        message - The permission update.
      • newsUpdated

        void newsUpdated​(Subscription subscription,
                         Peer peer,
                         NewsMessage message)

        Called when a news headline update is received.

        Parameters:
        subscription - The subscription for which the update occurred.
        peer - The DataSource peer supplying the update.
        message - The news update.
      • storyUpdated

        void storyUpdated​(Subscription subscription,
                          Peer peer,
                          StoryMessage message)

        Called when a story update is received.

        Parameters:
        subscription - The subscription for which the update occurred.
        peer - The DataSource peer supplying the update.
        message - The story update.
      • containerUpdated

        void containerUpdated​(Subscription subscription,
                              Peer peer,
                              ContainerMessage message)

        Called when a container update is received.

        Parameters:
        subscription - The subscription for which the update occurred.
        peer - The DataSource peer supplying the update.
        message - 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.

      • pageUpdated

        void pageUpdated​(Subscription subscription,
                         Peer peer,
                         PageMessage message)

        Called when a page update is received.

        Parameters:
        subscription - The subscription for which the update occurred.
        peer - The DataSource peer supplying the update.
        message - The page update.
      • subjectErrorReceived

        void subjectErrorReceived​(Subscription subscription,
                                  Peer peer,
                                  SubjectErrorEvent subjectErrorEvent)

        Called when there is an error in a subscription.

        Parameters:
        subscription - The subscription for which the error occurred.
        peer - The DataSource peer that sent this subscription error.
        subjectErrorEvent - The subscription error.
      • subjectStatusReceived

        void subjectStatusReceived​(Subscription subscription,
                                   Peer peer,
                                   SubjectStatusEvent subjectStatusEvent)

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

        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.