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

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

public abstract class BrokerSubscription<LISTENER extends javax.jms.MessageListener>
extends Thread
implements javax.jms.ExceptionListener

Author:
Andrea Manzi(CERN)

Nested Class Summary
 class BrokerSubscription.TopicCouple
          topic couple
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
protected static int ackMode
           
protected  ArrayList<javax.jms.Connection> connections
           
protected  BrokerSubscription.TopicCouple couple
           
protected  LISTENER listener
           
protected static org.gcube.common.core.utils.logging.GCUBELog logger
           
protected  ArrayList<String> messageSelectors
           
protected  boolean queue
           
protected static boolean transacted
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
BrokerSubscription()
          default constructor
 
Method Summary
 ArrayList<javax.jms.Connection> getConnections()
          Get the list of connections
 BrokerSubscription.TopicCouple getCouple()
          get the topic info
 LISTENER getListener()
          Get the listener associated to the subscription
 ArrayList<String> getMessageSelectors()
          Get the message Selectors for this subscription
 void onException(javax.jms.JMSException exce)
          
 void run()
           
 void setConnections(ArrayList<javax.jms.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(ArrayList<String> messageSelectors)
          Set the message selectors for this subscription
abstract  void setScope(org.gcube.common.core.scope.GCUBEScope scope)
          set the scope
 void setupDurableSubscribers(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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

couple

protected BrokerSubscription.TopicCouple couple

messageSelectors

protected ArrayList<String> messageSelectors

listener

protected LISTENER extends javax.jms.MessageListener listener

logger

protected static org.gcube.common.core.utils.logging.GCUBELog logger

connections

protected ArrayList<javax.jms.Connection> connections

transacted

protected static boolean transacted

ackMode

protected static int ackMode

queue

protected boolean queue
Constructor Detail

BrokerSubscription

public BrokerSubscription()
default constructor

Method Detail

setScope

public abstract void setScope(org.gcube.common.core.scope.GCUBEScope scope)
set the scope

Parameters:
scope - the scope to set

subscribe

public void subscribe()
               throws Exception
subscribe

Throws:
Exception

getConnections

public ArrayList<javax.jms.Connection> getConnections()
Get the list of connections

Returns:
the list of connections

setConnections

public void setConnections(ArrayList<javax.jms.Connection> connections)
Set the list of connections

Parameters:
connections - the list of connections

setupDurableSubscribers

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

setupQueueSubscription

public void setupQueueSubscription()
                            throws Exception
setupQueueSubscription

Throws:
Exception

run

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

onException

public void onException(javax.jms.JMSException exce)

Specified by:
onException in interface javax.jms.ExceptionListener

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 ArrayList<String> getMessageSelectors()
Get the message Selectors for this subscription

Returns:
the message selectors

setMessageSelectors

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

Parameters:
messageSelectors - the message selector


Copyright © 2013. All Rights Reserved.