|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.lang.Thread
org.apache.commons.messagelet.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
| 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. |
java.lang.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(java.lang.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(java.lang.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, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, 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()
public javax.jms.Destination getDestination()
public javax.jms.MessageListener getListener()
public Messenger getMessenger()
public java.lang.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(java.lang.String selector)
selector - The selector to setpublic void setShouldStop(boolean shouldStop)
shouldStop - The shouldStop to set
protected 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 java.lang.Exception
java.lang.Exception
protected void commitTransaction()
throws java.lang.Exception
java.lang.Exceptionprotected void rollbackTransaction(java.lang.Exception e)
protected void cancelTransaction()
throws java.lang.Exception
java.lang.Exceptionprotected javax.jms.MessageConsumer getConsumer()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||