|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atomikos.jms.MessageConsumerSession com.atomikos.jms.QueueReceiverSession
public class QueueReceiverSession
A light-weight alternative for message-driven beans: the QueueReceiverSession allows MessageListener instances to listen on JMS messages in a transactional way (non-transactional mode is not supported). This class is implemented as a JavaBean to facilitate integration in third-party frameworks. This session is long-lived in the sense that underlying JMS resources are refreshed regularly. In particular, clients should not worry about the connection or session timing out. This allows this class to be used for server-type applications.
IMPORTANT: the transactional behaviour guarantees redelivery after failures.
As a side-effect, this can lead to so-called poison messages: messages
whose processing repeatedly fails due to some recurring error (for instance, a primary
key violation in the database, a NullPointerException, ...).
Poison messages are problematic
because they can prevent other messages from being processed, and block the system.
Some messaging systems
provide a way to deal with poison messages, others don't. In that case, it is up
to the registered MessageListener to detect poison messages. The easiest way to
detect these is by inspecting the JMSRedelivered
header and/or the
(sometimes available) JMS property called JMSXDeliveryCount
. For instance, if the
delivery count is too high then your application may choose to send the message to
a dedicated problem queue and thereby avoid processing errors. Whatever you do, beware
that messages are sometimes correctly redelivered, in particular after a prior crash of the
application.
Instances of this class consume JMS messages in a single thread only. Use QueueReceiverSessionPool if you want to have multiple concurrent threads for the same queue.
Field Summary |
---|
Fields inherited from class com.atomikos.jms.MessageConsumerSession |
---|
current |
Constructor Summary | |
---|---|
QueueReceiverSession()
Create a new instance. |
Method Summary | |
---|---|
protected String |
getDestinationName()
|
protected boolean |
getNoLocal()
|
javax.jms.Queue |
getQueue()
Get the queue. |
QueueConnectionFactoryBean |
getQueueConnectionFactoryBean()
Get the queue connection factory. |
protected String |
getSubscriberName()
|
protected void |
setNoLocal(boolean value)
|
void |
setQueue(javax.jms.Queue queue)
Set the queue to use for listening on. |
void |
setQueueConnectionFactoryBean(QueueConnectionFactoryBean factory)
Set the queue connection factory to use. |
protected void |
setSubscriberName(String name)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public QueueReceiverSession()
Method Detail |
---|
public void setQueueConnectionFactoryBean(QueueConnectionFactoryBean factory)
factory
- The queue connection factory. This factory needs to be
configured independently before this method is called.public QueueConnectionFactoryBean getQueueConnectionFactoryBean()
public void setQueue(javax.jms.Queue queue)
queue
- This is the queue where messages are to be taken off
transactionally.public javax.jms.Queue getQueue()
protected String getDestinationName()
getDestinationName
in class MessageConsumerSession
protected boolean getNoLocal()
getNoLocal
in class MessageConsumerSession
protected String getSubscriberName()
getSubscriberName
in class MessageConsumerSession
protected void setNoLocal(boolean value)
setNoLocal
in class MessageConsumerSession
protected void setSubscriberName(String name)
setSubscriberName
in class MessageConsumerSession
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |