|
||||||||||
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.TopicSubscriberSession
public class TopicSubscriberSession
A light-weight alternative for message-driven beans: the TopicReceiverSession 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 TopicReceiverSessionPool if you want to have multiple concurrent threads for the same topic.
Topic functionality in this product was sponsored by Webtide.
Field Summary |
---|
Fields inherited from class com.atomikos.jms.MessageConsumerSession |
---|
current |
Constructor Summary | |
---|---|
TopicSubscriberSession()
Creates a new instance to be configured via the setters. |
Method Summary | |
---|---|
protected String |
getDestinationName()
|
boolean |
getNoLocal()
Gets the NoLocal flag value. |
String |
getSubscriberName()
Gets the subscriber name. |
javax.jms.Topic |
getTopic()
Gets the topic to listen on. |
TopicConnectionFactoryBean |
getTopicConnectionFactoryBean()
Gets the connection factory used. |
void |
setNoLocal(boolean value)
Sets nolocal value (optional). |
void |
setSubscriberName(String name)
Sets the durable subscriber name (optional). |
void |
setTopic(javax.jms.Topic topic)
Sets the topic to listen on. |
void |
setTopicConnectionFactoryBean(TopicConnectionFactoryBean factory)
Sets the connection factory to use. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TopicSubscriberSession()
Method Detail |
---|
public void setTopicConnectionFactoryBean(TopicConnectionFactoryBean factory)
factory
- This factory needs to be
configured independently before this method is called.public TopicConnectionFactoryBean getTopicConnectionFactoryBean()
public void setTopic(javax.jms.Topic topic)
topic
- Transactional receives will come from this topic.public javax.jms.Topic getTopic()
protected String getDestinationName()
getDestinationName
in class MessageConsumerSession
public boolean getNoLocal()
getNoLocal
in class MessageConsumerSession
public String getSubscriberName()
getSubscriberName
in class MessageConsumerSession
public void setNoLocal(boolean value)
setNoLocal
in class MessageConsumerSession
value
- Defaults to false.public void setSubscriberName(String name)
setSubscriberName
in class MessageConsumerSession
name
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |