Interface SubscriptionListener
- All Known Implementing Classes:
BaseSubscriptionListener
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 Summary
Modifier and TypeMethodDescriptionvoid
onChatUpdate
(Subscription subscription, ChatEvent evt) Called when a chat update is received.void
onContainerUpdate
(Subscription subscription, ContainerEvent evt) Called when a container update is received.void
onDirectoryUpdate
(Subscription subscription, DirectoryEvent evt) Called when a directory update is received.void
onJsonUpdate
(Subscription subscription, JsonEvent evt) Called when a json update is received.void
onNewsUpdate
(Subscription subscription, NewsEvent evt) Called when a news headline update is received.void
onPageUpdate
(Subscription subscription, PageEvent evt) Called when a page update is received.void
onPermissionUpdate
(Subscription subscription, PermissionEvent evt) Called when a permission update is received.void
onRecordType2Update
(Subscription subscription, RecordType2Event evt) Called when an update to type 2 data in a record is received.void
onRecordType3Update
(Subscription subscription, RecordType3Event evt) Called when an update to type 3 data in a record is received.void
onRecordUpdate
(Subscription subscription, RecordType1Event evt) Called when an update to type 1 data in a record is received.void
onStoryUpdate
(Subscription subscription, StoryEvent evt) Called when a news story update is received.void
onSubscriptionError
(Subscription subscription, SubscriptionErrorEvent evt) Called when there is an error in a subscription.void
onSubscriptionStatus
(Subscription subscription, SubscriptionStatusEvent evt) Called when there is a change in the status of a subscription.
-
Method Details
-
onRecordUpdate
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
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
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
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
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
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
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
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
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
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
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
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
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.
-