com.genesyslab.omsdk.qil.applicationblocks.monitoring.listeners
Class InteractionListeners

java.lang.Object
  extended bycom.genesyslab.omsdk.qil.applicationblocks.monitoring.listeners.InteractionListeners

public class InteractionListeners
extends java.lang.Object

Illustrates how to use the QIL InteractionListeners feature, and how to add to (or remove from) a queue's interaction listener list, used for subscribing to interaction events.
Note that this feature is distinct from QIL's QueueListeners feature.
This class assumes that QIL factory has already been successfully initialized.


Constructor Summary
InteractionListeners()
          Initializes the class, with a listener built in.
InteractionListeners(QILInteractionListener singleListener)
          Creates an InteractionListeners instance.
 
Method Summary
 void attachListener(java.lang.String queueName)
          Adds the listener for this instance to the interaction listeners list of the given queue.
 void dettachListener(java.lang.String queueName)
          Removes the listener for this instance from the interaction listeners list of the given queue.
 void startListening(java.lang.String queueName, QILInteractionListener listener)
          Adds the given listener to the interaction listeners list for the given queue.
 void stopListening(java.lang.String queueName, QILInteractionListener listener)
          Removes the given listener from the interaction listeners list for the given queue.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InteractionListeners

public InteractionListeners(QILInteractionListener singleListener)
Creates an InteractionListeners instance. This constructor accepts a listener for use in subscribing to events.

Parameters:
singleListener - listener

InteractionListeners

public InteractionListeners()
Initializes the class, with a listener built in.

Method Detail

startListening

public void startListening(java.lang.String queueName,
                           QILInteractionListener listener)
                    throws QILRequestFailedException
Adds the given listener to the interaction listeners list for the given queue.

To start getting events, call the StartMonitoringQueue.startMonitoring(String) method.

Parameters:
queueName - queue name.
listener - listener to be used for events dispatching.
Throws:
com.genesyslab.omsdk.qil.exception.QILRequestFailedException - various exceptions could be thrown from here, the most interesting being QILObjectNotFoundException, which indicates that queue was not found.
QILRequestFailedException

stopListening

public void stopListening(java.lang.String queueName,
                          QILInteractionListener listener)
                   throws QILRequestFailedException
Removes the given listener from the interaction listeners list for the given queue.

To stop getting events, call the StartMonitoringQueue.stopMonitoring(String) method.

Parameters:
queueName - queue name.
listener - listener that should be unsubscribed from events.
Throws:
com.genesyslab.omsdk.qil.exception.QILRequestFailedException - various exceptions could be thrown from here, the most interesting being QILObjectNotFoundException, which indicates that queue was not found.
QILRequestFailedException

attachListener

public void attachListener(java.lang.String queueName)
                    throws QILRequestFailedException
Adds the listener for this instance to the interaction listeners list of the given queue. This method uses the listener instance provided in the constructor.

Parameters:
queueName - queue name.
Throws:
com.genesyslab.omsdk.qil.exception.QILRequestFailedException - various exceptions could be thrown from here, the most interesting being QILObjectNotFoundException, which indicates that queue was not found.
QILRequestFailedException
See Also:
dettachListener(String)

dettachListener

public void dettachListener(java.lang.String queueName)
                     throws QILRequestFailedException
Removes the listener for this instance from the interaction listeners list of the given queue. This method uses the listener instance provided in constructor.

Parameters:
queueName - queue name.
Throws:
com.genesyslab.omsdk.qil.exception.QILRequestFailedException
QILRequestFailedException
See Also:
attachListener(String)