Interface SubscriptionListener

All Known Implementing Classes:
BaseSubscriptionListener

public interface SubscriptionListener

Interface for receiving updates to subscribed data from the Liberator.

Your application should implement this interface.

A trivial implementation of SubscriptionListener would be:

import com.caplin.streamlink.ChatEvent;
import com.caplin.streamlink.ContainerEvent;
import com.caplin.streamlink.DirectoryEvent;
import com.caplin.streamlink.NewsEvent;
import com.caplin.streamlink.PermissionEvent;
import com.caplin.streamlink.RecordType1Event;
import com.caplin.streamlink.RecordType2Event;
import com.caplin.streamlink.RecordType3Event;
import com.caplin.streamlink.StoryEvent;
import com.caplin.streamlink.StreamLink;
import com.caplin.streamlink.Subscription;
import com.caplin.streamlink.SubscriptionErrorEvent;
import com.caplin.streamlink.SubscriptionListener;
import com.caplin.streamlink.SubscriptionStatusEvent;


public class SubscriptionListenerSnippet
{
        
        public SubscriptionListenerSnippet(StreamLink streamLink) {
                streamLink.subscribe("/SUBJECT", new SubscriptionListener() {
                        
                        public void onSubscriptionStatus(Subscription subscription,
                        SubscriptionStatusEvent event) {
                                System.out.println(event);
                        }
                        
                        public void onSubscriptionError(Subscription subscription,
                        SubscriptionErrorEvent event) {
                                System.out.println(event);
                        }
                        
                        public void onStoryUpdate(Subscription subscription, StoryEvent event) {
                                System.out.println(event);
                        }
                        
                        public void onRecordUpdate(Subscription subscription, RecordType1Event event) {
                                System.out.println(event);
                        }
                        
                        public void onRecordType3Update(Subscription subscription,
                        RecordType3Event event) {
                                System.out.println(event);
                        }
                        
                        public void onRecordType2Update(Subscription subscription,
                        RecordType2Event event) {
                                System.out.println(event);
                        }
                        
                        public void onPermissionUpdate(Subscription subscription,
                        PermissionEvent event) {
                                System.out.println(event);
                        }
                        
                        public void onNewsUpdate(Subscription subscription, NewsEvent event) {
                                System.out.println(event);
                        }
                        
                        public void onDirectoryUpdate(Subscription subscription,
                        DirectoryEvent event) {
                                System.out.println(event);
                        }
                        
                        public void onContainerUpdate(Subscription subscription,
                        ContainerEvent event) {
                                System.out.println(event);
                        }
                        
                        public void onChatUpdate(Subscription subscription, ChatEvent event) {
                                System.out.println(event);
                        }
                        
                        public void onPageUpdate(Subscription subscription, ChatEvent event) {
                                System.out.println(event);
                        }
                        
                });
        }
        
}

  • Method Details

    • onRecordUpdate

      void onRecordUpdate(Subscription subscription, RecordType1Event evt)

      Called when an update to type 1 data in a record is received. Implementing this method is optional.

      Parameters:
      subscription - The subscription for which the update occurred.
      evt - The record update.
    • onRecordType2Update

      void onRecordType2Update(Subscription subscription, RecordType2Event evt)

      Called when an update to type 2 data in a record is received. Implementing this method is optional.

      Parameters:
      subscription - The subscription for which the update occurred.
      evt - The record update.
    • onRecordType3Update

      void onRecordType3Update(Subscription subscription, RecordType3Event evt)

      Called when an update to type 3 data in a record is received. Implementing this method is optional.

      Parameters:
      subscription - The subscription for which the update occurred.
      evt - The record update.
    • onPermissionUpdate

      void onPermissionUpdate(Subscription subscription, PermissionEvent evt)

      Called when a permission update is received. Implementing this method is optional.

      Parameters:
      subscription - The subscription for which the update occurred.
      evt - The permission update.
    • onNewsUpdate

      void onNewsUpdate(Subscription subscription, NewsEvent evt)

      Called when a news headline update is received. Implementing this method is optional.

      Parameters:
      subscription - The subscription for which the update occurred.
      evt - The news headline update.
    • onStoryUpdate

      void onStoryUpdate(Subscription subscription, StoryEvent evt)

      Called when a news story update is received. Implementing this method is optional.

      Parameters:
      subscription - The subscription for which the update occurred.
      evt - The news story update.
    • onPageUpdate

      void onPageUpdate(Subscription subscription, PageEvent evt)

      Called when a page update is received. Implementing this method is optional.

      Parameters:
      subscription - The subscription for which the update occurred.
      evt - The page update.
    • onChatUpdate

      void onChatUpdate(Subscription subscription, ChatEvent evt)

      Called when a chat update is received. Implementing this method is optional.

      Parameters:
      subscription - The subscription for which the update occurred.
      evt - The chat update.
    • onDirectoryUpdate

      void onDirectoryUpdate(Subscription subscription, DirectoryEvent evt)

      Called when a directory update is received. Implementing this method is optional.

      Parameters:
      subscription - The subscription for which the update occurred.
      evt - The directory update.
    • onContainerUpdate

      void onContainerUpdate(Subscription subscription, ContainerEvent evt)

      Called when a container update is received. Implementing this method is optional.

      Parameters:
      subscription - The subscription for which the update occurred.
      evt - The container update.
    • onJsonUpdate

      void onJsonUpdate(Subscription subscription, JsonEvent evt)

      Called when a json update is received. Implementing this method is optional.

      Parameters:
      subscription - The subscription for which the update occurred.
      evt - The JSON update.
    • onSubscriptionStatus

      void onSubscriptionStatus(Subscription subscription, SubscriptionStatusEvent evt)

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

      Parameters:
      subscription - The subscription for which the update occurred.
      evt - The subscription status event.
    • onSubscriptionError

      void onSubscriptionError(Subscription subscription, SubscriptionErrorEvent evt)

      Called when there is an error in a subscription.

      This callback being invoked is a final state for the subscription and no further callbacks will be received for it.

      Parameters:
      subscription - The subscription for which the error occurred.
      evt - The subscription error event.