public interface SubscriptionListener
Subscription
events comprehending notifications of subscription/unsubscription,
updates, errors and others. ClientListener
s, SubscriptionListener
s and ClientMessageListener
s will be dispatched by the
same thread.Modifier and Type | Method and Description |
---|---|
void |
onClearSnapshot(java.lang.String itemName,
int itemPos)
Event handler that is called by Lightstreamer each time a request to clear the snapshot pertaining to an item
in the Subscription has been received from the Server.
|
void |
onCommandSecondLevelItemLostUpdates(int lostUpdates,
java.lang.String key)
Event handler that is called by Lightstreamer to notify that, due to internal resource limitations,
Lightstreamer Server dropped one or more updates for an item that was subscribed to as a second-level subscription.
|
void |
onCommandSecondLevelSubscriptionError(int code,
java.lang.String message,
java.lang.String key)
Event handler that is called when the Server notifies an error on a second-level subscription.
|
void |
onEndOfSnapshot(java.lang.String itemName,
int itemPos)
Event handler that is called by Lightstreamer to notify that all snapshot events for an item in the
Subscription have been received, so that real time events are now going to be received.
|
void |
onItemLostUpdates(java.lang.String itemName,
int itemPos,
int lostUpdates)
Event handler that is called by Lightstreamer to notify that, due to internal resource limitations,
Lightstreamer Server dropped one or more updates for an item in the Subscription.
|
void |
onItemUpdate(ItemUpdate itemUpdate)
Event handler that is called by Lightstreamer each time an update pertaining to an item in the Subscription
has been received from the Server.
|
void |
onListenEnd(Subscription subscription)
Event handler that receives a notification when the SubscriptionListener instance is removed from a Subscription
through
Subscription.removeListener(SubscriptionListener) . |
void |
onListenStart(Subscription subscription)
Event handler that receives a notification when the SubscriptionListener instance is added to a Subscription
through
Subscription.addListener(SubscriptionListener) . |
void |
onRealMaxFrequency(java.lang.String frequency)
Event handler that is called by Lightstreamer to notify the client with the real maximum update frequency of the Subscription.
|
void |
onSubscription()
Event handler that is called by Lightstreamer to notify that a Subscription has been successfully subscribed
to through the Server.
|
void |
onSubscriptionError(int code,
java.lang.String message)
Event handler that is called when the Server notifies an error on a Subscription.
|
void |
onUnsubscription()
Event handler that is called by Lightstreamer to notify that a Subscription has been successfully unsubscribed
from.
|
void onClearSnapshot(@Nullable java.lang.String itemName, int itemPos)
Subscription.setCommandSecondLevelFields(String[])
and Subscription.setCommandSecondLevelFieldSchema(String)
)
, the notification refers to the first-level item (which is in COMMAND mode).
This kind of notification is not possible for second-level items (which are in MERGE
mode).itemName
- name of the involved item. If the Subscription was initialized using an "Item Group" then a
null value is supplied.itemPos
- 1-based position of the item within the "Item List" or "Item Group".void onCommandSecondLevelItemLostUpdates(int lostUpdates, @Nonnull java.lang.String key)
lostUpdates
- The number of consecutive updates dropped for the item.key
- The value of the key that identifies the second-level item.Subscription.setRequestedMaxFrequency(String)
,
Subscription.setCommandSecondLevelFields(String[])
,
Subscription.setCommandSecondLevelFieldSchema(String)
void onCommandSecondLevelSubscriptionError(int code, @Nullable java.lang.String message, java.lang.String key)
code
- The error code sent by the Server. It can be one of the following:
message
- The description of the error sent by the Server; it can be null.key
- The value of the key that identifies the second-level item.ConnectionDetails.setAdapterSet(String)
,
Subscription.setCommandSecondLevelFields(String[])
,
Subscription.setCommandSecondLevelFieldSchema(String)
void onEndOfSnapshot(@Nullable java.lang.String itemName, int itemPos)
Subscription.setCommandSecondLevelFields(String[])
and Subscription.setCommandSecondLevelFieldSchema(String)
)
, the notification refers to the first-level item (which is in COMMAND mode).
Snapshot-related updates for the second-level items
(which are in MERGE mode) can be received both before and after this notification.itemName
- name of the involved item. If the Subscription was initialized using an "Item Group" then a
null value is supplied.itemPos
- 1-based position of the item within the "Item List" or "Item Group".Subscription.setRequestedSnapshot(String)
,
ItemUpdate.isSnapshot
void onItemLostUpdates(@Nullable java.lang.String itemName, int itemPos, int lostUpdates)
itemName
- name of the involved item. If the Subscription was initialized using an "Item Group" then a
null value is supplied.itemPos
- 1-based position of the item within the "Item List" or "Item Group".lostUpdates
- The number of consecutive updates dropped for the item.Subscription.setRequestedMaxFrequency(String)
void onItemUpdate(@Nonnull ItemUpdate itemUpdate)
itemUpdate
- a value object containing the updated values for all the fields, together with meta-information
about the update itself and some helper methods that can be used to iterate through all or new values.void onListenEnd(@Nonnull Subscription subscription)
Subscription.removeListener(SubscriptionListener)
. This is the last event to be fired on the listener.subscription
- the Subscription this instance was removed from.void onListenStart(@Nonnull Subscription subscription)
Subscription.addListener(SubscriptionListener)
. This is the first event to be fired on the listener.subscription
- the Subscription this instance was added to.void onSubscription()
LightstreamerClient.unsubscribe(Subscription)
and
LightstreamerClient.subscribe(Subscription)
. This can also happen multiple times in case of automatic
recovery after a connection restart. onUnsubscription()
event is eventually fired. Subscription.setCommandSecondLevelFields(String[])
and Subscription.setCommandSecondLevelFieldSchema(String)
)
, second-level subscriptions are not notified.void onSubscriptionError(int code, @Nullable java.lang.String message)
LightstreamerClient.unsubscribe(Subscription)
and LightstreamerClient.subscribe(Subscription)
should be issued again, even if no change to the Subscription
attributes has been applied.code
- The error code sent by the Server. It can be one of the following:
message
- The description of the error sent by the Server; it can be null.ConnectionDetails.setAdapterSet(String)
void onUnsubscription()
LightstreamerClient.unsubscribe(Subscription)
and
LightstreamerClient.subscribe(Subscription)
. This can also happen multiple times in case of automatic
recovery after a connection restart. onSubscription()
event is eventually fired. Subscription.setCommandSecondLevelFields(String[])
and Subscription.setCommandSecondLevelFieldSchema(String)
)
, second-level unsubscriptions are not notified.void onRealMaxFrequency(@Nullable java.lang.String frequency)
Subscription.setRequestedMaxFrequency(String)
).
Since the frequency limit is applied on an item basis and a Subscription can involve multiple items,
this is actually the maximum frequency among all items. For Subscriptions with two-level behavior
(see Subscription.setCommandSecondLevelFields(String[])
and Subscription.setCommandSecondLevelFieldSchema(String)
)
, the reported frequency limit applies to both first-level and second-level items. frequency
- A decimal number, representing the maximum frequency applied by the Server
(expressed in updates per second), or the string "unlimited". A null value is possible in rare cases,
when the frequency can no longer be determined.