|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread org.apache.commons.messagelet.ConsumerThread
public class ConsumerThread
ConsumerThread
is a thread which will repeatedly consume JMS messages
using a receive() method on Messenger and then process the message.
This class is a good base class when implementing some kind of transactional processing of
JMS messages
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
ConsumerThread()
|
Method Summary | |
---|---|
protected void |
cancelTransaction()
Strategy method to represent the code required to cancel a transaction. |
protected void |
commitTransaction()
Strategy method to represent the code required to commit a transaction. |
protected javax.jms.MessageConsumer |
createConsumer()
Factory method to create a new MessageConsumer |
protected javax.jms.MessageConsumer |
getConsumer()
|
javax.jms.Destination |
getDestination()
Returns the destination. |
javax.jms.MessageListener |
getListener()
Returns the listener. |
Messenger |
getMessenger()
Returns the messenger. |
String |
getSelector()
Returns the selector. |
boolean |
isShouldStop()
Returns the shouldStop. |
protected void |
processMessage(javax.jms.Message message)
Strategy method to process a given message. |
protected void |
rollbackTransaction(Exception e)
Strategy method to represent the code required to rollback a transaction. |
void |
run()
Starts all the JMS connections and consumes JMS messages, passing them onto the MessageListener and Message Driven Objects |
void |
setDestination(javax.jms.Destination destination)
Sets the destination. |
void |
setListener(javax.jms.MessageListener listener)
Sets the listener. |
void |
setMessenger(Messenger messenger)
Sets the messenger. |
void |
setSelector(String selector)
Sets the selector. |
void |
setShouldStop(boolean shouldStop)
Sets the shouldStop. |
protected void |
startConsumer()
Starts consuming messages |
protected void |
startTransaction()
Strategy method to represent the code required to start a transaction. |
protected void |
stopConsumer()
Stops consuming messages |
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 |
Constructor Detail |
---|
public ConsumerThread()
Method Detail |
---|
public void run()
run
in interface Runnable
run
in class Thread
public javax.jms.Destination getDestination()
public javax.jms.MessageListener getListener()
public Messenger getMessenger()
public String getSelector()
public boolean isShouldStop()
public void setDestination(javax.jms.Destination destination)
destination
- The destination to setpublic void setListener(javax.jms.MessageListener listener)
listener
- The listener to setpublic void setMessenger(Messenger messenger)
messenger
- The messenger to setpublic void setSelector(String selector)
selector
- The selector to setpublic void setShouldStop(boolean shouldStop)
shouldStop
- The shouldStop to setprotected void startConsumer() throws javax.jms.JMSException
javax.jms.JMSException
protected void stopConsumer() throws javax.jms.JMSException
javax.jms.JMSException
protected javax.jms.MessageConsumer createConsumer() throws javax.jms.JMSException
javax.jms.JMSException
protected void processMessage(javax.jms.Message message) throws javax.jms.JMSException
javax.jms.JMSException
protected void startTransaction() throws Exception
Exception
protected void commitTransaction() throws Exception
Exception
protected void rollbackTransaction(Exception e)
protected void cancelTransaction() throws Exception
Exception
protected javax.jms.MessageConsumer getConsumer()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |