Interface MpnDeviceListener


public interface MpnDeviceListener
Interface to be implemented to receive MPN device events including registration, suspension/resume and status change.
Events for these listeners are dispatched by a different thread than the one that generates them. This means that, upon reception of an event, it is possible that the internal state of the client has changed. On the other hand, all the notifications for a single LightstreamerClient, including notifications to ClientListener, SubscriptionListener, ClientMessageListener, MpnDeviceListener and MpnSubscriptionListener will be dispatched by the same thread.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Event handler called when the MpnDeviceListener instance is removed from an MPN device object through MpnDevice.removeListener(MpnDeviceListener).
    This is the last event to be fired on the listener.
    void
    Event handler called when the MpnDeviceListener instance is added to an MPN device object through MpnDevice.addListener(MpnDeviceListener).
    This is the first event to be fired on the listener.
    void
    Event handler called when an MPN device object has been successfully registered on the server's MPN Module.
    This event handler is always called before other events related to the same device.
    Note that this event can be called multiple times in the life of an MPN device object in case the client disconnects and reconnects.
    void
    onRegistrationFailed(int code, String message)
    Event handler called when the server notifies an error while registering an MPN device object.
    By implementing this method it is possible to perform recovery actions.
    void
    Event handler called when an MPN device object has been resumed on the server's MPN Module.
    An MPN device may be resumed from suspended state at the first subsequent registration.
    Note that in some server clustering configurations this event may not be called.
    void
    onStatusChanged(String status, long timestamp)
    Event handler called when the server notifies that an MPN device changed its status.
    Note that in some server clustering configurations the status change for the MPN device suspend event may not be called.
    void
    Event handler called when the server notifies that the list of MPN subscription associated with an MPN device has been updated.
    After registration, the list of pre-existing MPN subscriptions for the MPN device is updated and made available through the LightstreamerClient.getMpnSubscriptions(String) method.
    void
    Event handler called when an MPN device object has been suspended on the server's MPN Module.
    An MPN device may be suspended if errors occur during push notification delivery.
    Note that in some server clustering configurations this event may not be called.
  • Method Details

    • onListenStart

      void onListenStart()
      Event handler called when the MpnDeviceListener instance is added to an MPN device object through MpnDevice.addListener(MpnDeviceListener).
      This is the first event to be fired on the listener.
    • onListenEnd

      void onListenEnd()
      Event handler called when the MpnDeviceListener instance is removed from an MPN device object through MpnDevice.removeListener(MpnDeviceListener).
      This is the last event to be fired on the listener.
    • onRegistered

      void onRegistered()
      Event handler called when an MPN device object has been successfully registered on the server's MPN Module.
      This event handler is always called before other events related to the same device.
      Note that this event can be called multiple times in the life of an MPN device object in case the client disconnects and reconnects. In this case the device is registered again automatically.
    • onSuspended

      void onSuspended()
      Event handler called when an MPN device object has been suspended on the server's MPN Module.
      An MPN device may be suspended if errors occur during push notification delivery.
      Note that in some server clustering configurations this event may not be called.
    • onResumed

      void onResumed()
      Event handler called when an MPN device object has been resumed on the server's MPN Module.
      An MPN device may be resumed from suspended state at the first subsequent registration.
      Note that in some server clustering configurations this event may not be called.
    • onStatusChanged

      void onStatusChanged(@Nonnull String status, long timestamp)
      Event handler called when the server notifies that an MPN device changed its status.
      Note that in some server clustering configurations the status change for the MPN device suspend event may not be called.
      Parameters:
      status - The new status of the MPN device. It can be one of the following:
      • UNKNOWN
      • REGISTERED
      • SUSPENDED
      timestamp - The server-side timestamp of the new device status.
      See Also:
    • onRegistrationFailed

      void onRegistrationFailed(int code, @Nonnull String message)
      Event handler called when the server notifies an error while registering an MPN device object.
      By implementing this method it is possible to perform recovery actions.
      Parameters:
      code - The error code sent by the Server. It can be one of the following:
      • 40 - the MPN Module is disabled, either by configuration or by license restrictions.
      • 41 - the request failed because of some internal resource error (e.g. database connection, timeout, etc.).
      • 43 - invalid or unknown application ID.
      • 45 - invalid or unknown MPN device ID.
      • 48 - MPN device suspended.
      • 66 - an unexpected exception was thrown by the Metadata Adapter while authorizing the connection.
      • 68 - the Server could not fulfill the request because of an internal error.
      • <= 0 - the Metadata Adapter has refused the subscription request; the code value is dependent on the specific Metadata Adapter implementation.
      message - The description of the error sent by the Server; it can be null.
    • onSubscriptionsUpdated

      void onSubscriptionsUpdated()
      Event handler called when the server notifies that the list of MPN subscription associated with an MPN device has been updated.
      After registration, the list of pre-existing MPN subscriptions for the MPN device is updated and made available through the LightstreamerClient.getMpnSubscriptions(String) method.
      See Also: