Interface ConsumerOperationsInterface


  • public interface ConsumerOperationsInterface
    ConsumerOperationsInterface is an interface that specifies the standard operations to enable a client to receive events on specific channels from a remote Correlator.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String PROPERTY_CONSUMER_CHANNELS
      The string name of the bound property that is used for "consumerChannels" updates (typically "consumerChannels", but this constant should be used to be sure).
      static java.lang.String PROPERTY_CONSUMER_CONNECTED
      The string name of the bound property that is used for "consumerConnected" updates (typically "consumerConnected", but this constant should be used to be sure).
    • Field Detail

      • PROPERTY_CONSUMER_CONNECTED

        static final java.lang.String PROPERTY_CONSUMER_CONNECTED
        The string name of the bound property that is used for "consumerConnected" updates (typically "consumerConnected", but this constant should be used to be sure).
        See Also:
        Constant Field Values
      • PROPERTY_CONSUMER_CHANNELS

        static final java.lang.String PROPERTY_CONSUMER_CHANNELS
        The string name of the bound property that is used for "consumerChannels" updates (typically "consumerChannels", but this constant should be used to be sure).
        See Also:
        Constant Field Values
    • Method Detail

      • getName

        java.lang.String getName()
        Get the name of this consumer. (This is a read-only property.)
        Returns:
        the name of this consumer.
      • setChannels

        void setChannels​(java.lang.String[] channels)
                  throws EngineException
        Set the list of channel names to which this consumer is subscribed.
        Parameters:
        channels - The set of channels to which to subscribe. Must be non-null, and contain no null elements.
        Throws:
        EngineException - Thrown if any exceptions occur in the Client SDK, or if the channels parameter is invalid.
      • getChannels

        java.lang.String[] getChannels()
        Get the list of channel names to which this consumer is subscribed.
        Returns:
        the list of channels.
      • isConsumerConnected

        boolean isConsumerConnected()
        Determine if this consumer is really connected to the remote Correlator. (This is a read-only property.)
        Returns:
        true if connected, false otherwise.
      • addEventListener

        void addEventListener​(IEventListener listener)
        Add a listener that will be notified whenever events are received on any of the channels on which this consumer is listening.

        Threading note: unless this was created as an asynchronous consumer, it is essential that the specified event listener does not lock the consumer or bean, and does not call any methods on the consumer or bean, to avoid the possibility of deadlock. If the handler does need to call bean methods (e.g. to send events) then an asynchronous named consumer must be used instead.

        Note that only the plural handleEvents(Event[]) method of the listener will be called. Clients should consider using the EventListenerAdapter adapter class so that events can be handled one at a time by implementing only the EventListenerAdapter.handleEvent(com.apama.event.Event) method.

        Parameters:
        listener - the listener to be added.
      • removeEventListener

        void removeEventListener​(IEventListener listener)
        Remove a previously added event listener.
        Parameters:
        listener - the listener to be removed.
      • getEventListeners

        IEventListener[] getEventListeners()
        Get a list of all subscribed listeners (as an array).
        Returns:
        the list of event listeners.
      • removeAllEventListeners

        void removeAllEventListeners()
        Remove all event listeners that are listening to this consumer.
      • removePropertyChangeListener

        void removePropertyChangeListener​(java.beans.PropertyChangeListener listener)
        Remove a property change listener.
        Parameters:
        listener - the listener to be removed.
      • removePropertyChangeListener

        void removePropertyChangeListener​(java.lang.String propertyName,
                                          java.beans.PropertyChangeListener listener)
        Remove a property change listener for a specific named property.
        Parameters:
        propertyName - the name of the property that was listened on.
        listener - the listener to be removed.
      • addPropertyChangeListener

        void addPropertyChangeListener​(java.beans.PropertyChangeListener listener)
        Add a property change listener. Use this method to be informed whenever a property value is changed. Since Apama 5.2, listeners registered with this method will be called back asynchronously on a dedicated thread, which means it is permissible to call any engine client method from the listener - though be aware that the property value could have changed since the property change notification was fired, so may be different to the specified 'new value'. Applications that need the previous synchronous notification behaviour can use addPropertyChangeListenerSync to help with migration.
        Parameters:
        listener - the listener to be added.
      • addPropertyChangeListener

        void addPropertyChangeListener​(java.lang.String propertyName,
                                       java.beans.PropertyChangeListener listener)
        Add a property change listener for a specific named property. Since Apama 5.2, listeners registered with this method will be called back asynchronously on a dedicated thread, which means it is permissible to call any engine client method from the listener - though be aware that the property value could have changed since the property change notification was fired, so may be different to the specified 'new value'. Applications that need the previous synchronous notification behaviour can use addPropertyChangeListenerSync to help with migration.
        Parameters:
        propertyName - the name of the property to listen on.
        listener - the listener to be added.
      • addPropertyChangeListenerSync

        @Deprecated
        void addPropertyChangeListenerSync​(java.beans.PropertyChangeListener listener)
        Deprecated.
        Use addPropertyChangeListener instead
        Add a property change listener (with synchronous notifications). This method is deprecated and applications should use addPropertyChangeListener instead wherever possible, however this method is provided to simplify migration from pre-5.2 Apama releases which provided synchronous listener behaviour by default. To avoid the possibility of deadlock, it is essential that listeners registered using this method do not attempt to make calls back into the engine client (or any other service that uses it).
        Parameters:
        listener - the listener to be added.
      • addPropertyChangeListenerSync

        @Deprecated
        void addPropertyChangeListenerSync​(java.lang.String propertyName,
                                           java.beans.PropertyChangeListener listener)
        Deprecated.
        Use addPropertyChangeListener instead
        Add a property change listener for a specific named property. This method is deprecated and applications should use addPropertyChangeListener instead wherever possible, however this method is provided to simplify migration from pre-5.2 Apama releases which provided synchronous listener behaviour by default. To avoid the possibility of deadlock, it is essential that listeners registered using this method do not attempt to make calls back into the engine client (or any other service that uses it).
        Parameters:
        propertyName - the name of the property to listen on.
        listener - the listener to be added.
      • removePropertyChangeListenerSync

        @Deprecated
        void removePropertyChangeListenerSync​(java.beans.PropertyChangeListener listener)
        Deprecated.
        Remove a property change listener registered with addPropertyChangeListenerSync.
        Parameters:
        listener - the listener to be removed.
      • removePropertyChangeListenerSync

        @Deprecated
        void removePropertyChangeListenerSync​(java.lang.String propertyName,
                                              java.beans.PropertyChangeListener listener)
        Deprecated.
        Remove a property change listener for a specific named property registered with addPropertyChangeListenerSync.
        Parameters:
        propertyName - the name of the property that was listened on.
        listener - the listener to be removed.