Package cern.dip

Interface DipSubscriptionListener

  • All Known Implementing Classes:
    DipSubscriptionListenerAdapter

    public interface DipSubscriptionListener
    Interface for DIP subscription Listeners. DipSubscriptionListener objects must implement listener methods for reception of DIP data and exceptions. The initial state of the connection to the publisher can be assumed "disconnected" until connected() has been called;
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void connected​(DipSubscription subscription)
      Will be called when the subscription has been (re)connected to the publication's publisher.
      void disconnected​(DipSubscription subscription, java.lang.String reason)
      Will be called when the subscription has been disconnected from the message provider (Due to the publisher becoming unavailable or some failure in the DIP protocol).
      void handleException​(DipSubscription subscription, java.lang.Exception ex)
      Will be called when an exception, other than the disconnection has occured.
      void handleMessage​(DipSubscription subscription, DipData message)
      Will be called on reception of updated publication information.
    • Method Detail

      • handleMessage

        void handleMessage​(DipSubscription subscription,
                           DipData message)
        Will be called on reception of updated publication information. Implementation must be provided by the developer. It is important to check the quality of the data as this may determine how its value is treated. It is essential that the implementor determines the quality of the message received before processing the messages data.
        Parameters:
        subscription - - the subscription object whose publication has been updated (Thus allowing one handler to be used for multiple subscribtions).
        message - - contains updated publication data. The value, timestamp, data quality etc. can be extracted from the message with DipData methods.
      • disconnected

        void disconnected​(DipSubscription subscription,
                          java.lang.String reason)
        Will be called when the subscription has been disconnected from the message provider (Due to the publisher becoming unavailable or some failure in the DIP protocol). The developer must provide the appropriate implementation.
        Parameters:
        subscription - - indicates which subscription is broken (DIP will automatically attempt to resubscribe).
        reason - - why the subscription broke.
      • connected

        void connected​(DipSubscription subscription)
        Will be called when the subscription has been (re)connected to the publication's publisher. The developer must provide the appropriate implementation.
        Parameters:
        subscription - - indicates which subscription is restored/active.
      • handleException

        void handleException​(DipSubscription subscription,
                             java.lang.Exception ex)
        Will be called when an exception, other than the disconnection has occured. These exceptions are generally asynch and , should they occur, related to the underlying DIP implementation. The exception to this is any uncaught exceptions in the above handlers will be forwarded to this handler.
        Parameters:
        subscription - the subscription this is causing the problem
        ex - problem description