public interface MpnSubscriptionListener
MpnSubscription
events including subscription/unsubscription, triggering and status change.LightstreamerClient
, including
notifications to ClientListener
, SubscriptionListener
, ClientMessageListener
, MpnDeviceListener
and MpnSubscriptionListener
will be dispatched by the same thread.Modifier and Type | Method and Description |
---|---|
void |
onListenEnd(MpnSubscription subscription)
Event handler called when the MpnSubscriptionListener instance is removed from an
MpnSubscription through
MpnSubscription.removeListener(MpnSubscriptionListener) .This is the last event to be fired on the listener. |
void |
onListenStart(MpnSubscription subscription)
Event handler called when the MpnSubscriptionListener instance is added to an
MpnSubscription through
MpnSubscription.addListener(MpnSubscriptionListener) .This is the first event to be fired on the listener. |
void |
onPropertyChanged(java.lang.String propertyName)
Event handler called each time the value of a property of
MpnSubscription is changed.Properties can be modified by direct calls to their setter or by server sent events. |
void |
onStatusChanged(java.lang.String status,
long timestamp)
Event handler called when the server notifies that an
MpnSubscription changed its status.Note that in some server clustering configurations the status change for the MPN subscription's trigger event may not be called. |
void |
onSubscription()
Event handler called when an
MpnSubscription has been successfully subscribed to on the server's MPN Module.This event handler is always called before other events related to the same subscription. Note that this event can be called multiple times in the life of an MpnSubscription instance only in case it is subscribed multiple times through LightstreamerClient.unsubscribe(MpnSubscription) and LightstreamerClient.subscribe(MpnSubscription, boolean) . |
void |
onSubscriptionError(int code,
java.lang.String message)
Event handler called when the server notifies an error while subscribing to an
MpnSubscription .By implementing this method it is possible to perform recovery actions. |
void |
onTriggered()
Event handler called when the server notifies that an
MpnSubscription did trigger.For this event to be called the MpnSubscription must have a trigger expression set and it must have been evaluated to true at least once. Note that this event can be called multiple times in the life of an MpnSubscription instance only in case it is subscribed multiple times through LightstreamerClient.unsubscribe(MpnSubscription) and LightstreamerClient.subscribe(MpnSubscription, boolean) . |
void |
onUnsubscription()
Event handler called when an
MpnSubscription has been successfully unsubscribed from on the server's MPN Module.After this call no more events can be received until a new onSubscription() event.Note that this event can be called multiple times in the life of an MpnSubscription instance only in case it is subscribed multiple times through LightstreamerClient.unsubscribe(MpnSubscription) and LightstreamerClient.subscribe(MpnSubscription, boolean) . |
void |
onUnsubscriptionError(int code,
java.lang.String message)
Event handler called when the server notifies an error while unsubscribing from an
MpnSubscription .By implementing this method it is possible to perform recovery actions. |
void onListenStart(@Nonnull MpnSubscription subscription)
MpnSubscription
through
MpnSubscription.addListener(MpnSubscriptionListener)
.subscription
- The MpnSubscription
this instance was added to.void onListenEnd(@Nonnull MpnSubscription subscription)
MpnSubscription
through
MpnSubscription.removeListener(MpnSubscriptionListener)
.subscription
- The MpnSubscription
this instance was removed from.void onSubscription()
MpnSubscription
has been successfully subscribed to on the server's MPN Module.LightstreamerClient.unsubscribe(MpnSubscription)
and LightstreamerClient.subscribe(MpnSubscription, boolean)
. Two consecutive calls
to this method are not possible, as before a second onSubscription()
event an onUnsubscription()
event is always fired.void onUnsubscription()
MpnSubscription
has been successfully unsubscribed from on the server's MPN Module.onSubscription()
event.LightstreamerClient.unsubscribe(MpnSubscription)
and LightstreamerClient.subscribe(MpnSubscription, boolean)
. Two consecutive calls
to this method are not possible, as before a second onUnsubscription()
event an onSubscription()
event is always fired.void onSubscriptionError(int code, @Nullable java.lang.String message)
MpnSubscription
.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.void onUnsubscriptionError(int code, @Nullable java.lang.String message)
MpnSubscription
.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.void onTriggered()
MpnSubscription
did trigger.LightstreamerClient.unsubscribe(MpnSubscription)
and LightstreamerClient.subscribe(MpnSubscription, boolean)
. Two consecutive calls
to this method are not possible.void onStatusChanged(@Nonnull java.lang.String status, long timestamp)
MpnSubscription
changed its status.status
- The new status of the MPN subscription. It can be one of the following:UNKNOWN
ACTIVE
SUBSCRIBED
TRIGGERED
timestamp
- The server-side timestamp of the new subscription status.MpnSubscription.getStatus()
,
MpnSubscription.getStatusTimestamp()
void onPropertyChanged(@Nonnull java.lang.String propertyName)
MpnSubscription
is changed.LightstreamerClient.subscribe(MpnSubscription, boolean)
).propertyName
- The name of the changed property. It can be one of the following:mode
group
schema
adapter
notification_format
trigger
requested_buffer_size
requested_max_frequency
status_timestamp