org.gcube.messaging.common.consumer
Class BrokerSubscription<LISTENER extends MessageListener>

java.lang.Object
  extended by java.lang.Thread
      extended by org.gcube.messaging.common.consumer.BrokerSubscription<LISTENER>
Type Parameters:
LISTENER -
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
CustomSubscription, GHNSubscription, NodeAccountingSubscription, PortalAccountingSubscription, RISubscription, SystemAccountingSubscription

public abstract class BrokerSubscription<LISTENER extends MessageListener>
extends java.lang.Thread

Author:
Andrea Manzi(CERN)

Nested Class Summary
 class BrokerSubscription.TopicCouple
          topic couple
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
BrokerSubscription()
          default constructor
 
Method Summary
 java.util.ArrayList<Connection> getConnections()
          Get the list of connections
 BrokerSubscription.TopicCouple getCouple()
          get the topic info
 LISTENER getListener()
          Get the listener associated to the subscription
 java.util.ArrayList<java.lang.String> getMessageSelectors()
          Get the message Selectors for this subscription
 void onException(JMSException exce)
          
 void run()
           
 void setConnections(java.util.ArrayList<Connection> connections)
          Set the list of connections
 void setCouple(BrokerSubscription.TopicCouple couple)
          set the topic info
 void setListener(LISTENER listener)
          set the listener associated to the connection
 void setMessageSelectors(java.util.ArrayList<java.lang.String> messageSelectors)
          Set the message selectors for this subscription
abstract  void setScope(GCUBEScope scope)
          set the scope
 void setupDurableSubscribers(java.lang.String... selector)
           
 void setupQueueSubscription()
          setupQueueSubscription
 void subscribe()
          subscribe
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BrokerSubscription

public BrokerSubscription()
default constructor

Method Detail

setScope

public abstract void setScope(GCUBEScope scope)
set the scope

Parameters:
scope - the scope to set

subscribe

public void subscribe()
               throws java.lang.Exception
subscribe

Throws:
java.lang.Exception

getConnections

public java.util.ArrayList<Connection> getConnections()
Get the list of connections

Returns:
the list of connections

setConnections

public void setConnections(java.util.ArrayList<Connection> connections)
Set the list of connections

Parameters:
connections - the list of connections

setupDurableSubscribers

public void setupDurableSubscribers(java.lang.String... selector)
                             throws java.lang.Exception
Throws:
java.lang.Exception

setupQueueSubscription

public void setupQueueSubscription()
                            throws java.lang.Exception
setupQueueSubscription

Throws:
java.lang.Exception

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

onException

public void onException(JMSException exce)


getCouple

public BrokerSubscription.TopicCouple getCouple()
get the topic info

Returns:
the topic info

setCouple

public void setCouple(BrokerSubscription.TopicCouple couple)
set the topic info

Parameters:
couple - the topic info

getListener

public LISTENER getListener()
Get the listener associated to the subscription

Returns:
the listener

setListener

public void setListener(LISTENER listener)
set the listener associated to the connection

Parameters:
listener - the listener

getMessageSelectors

public java.util.ArrayList<java.lang.String> getMessageSelectors()
Get the message Selectors for this subscription

Returns:
the message selectors

setMessageSelectors

public void setMessageSelectors(java.util.ArrayList<java.lang.String> messageSelectors)
Set the message selectors for this subscription

Parameters:
messageSelectors - the message selector