com.atomikos.jms
Class TopicSubscriberSessionPool

java.lang.Object
  extended by com.atomikos.jms.MessageConsumerSessionPool
      extended by com.atomikos.jms.TopicSubscriberSessionPool

public class TopicSubscriberSessionPool
extends MessageConsumerSessionPool

A pool for topic subscribers. For activating multiple threads on the same topic. Upon start, an instance of this class will create a number of concurrent sessions that listen for incoming messages on the same topic. MessageListener instances should be thread-safe if the pool size is larger than one. Note: in general, after start() any changed properties are only effective on the next start() event.

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.

Topic functionality in this product was sponsored by Webtide.


Constructor Summary
TopicSubscriberSessionPool()
           
 
Method Summary
protected  MessageConsumerSession createSession()
           
protected  boolean getNoLocal()
           
 String getSubscriberName()
          Gets the subscriber name (for durable subscribers).
 javax.jms.Topic getTopic()
          Gets the topic to listen on.
 TopicConnectionFactoryBean getTopicConnectionFactoryBean()
          Gets the topic connection factory.
 boolean isNoLocal()
          Test if this instance will receive sends from the same connection.
 void setNoLocal(boolean noLocal)
          Sets whether or not this topic should receive sends from the same connection (optional).
 void setSubscriberName(String subscriberName)
          Sets the name to use for durable subscriptions (optional).
 void setTopic(javax.jms.Topic topic)
          Sets the topic to listen on (required).
 void setTopicConnectionFactoryBean(TopicConnectionFactoryBean bean)
          Sets the topic connection factory to use (required).
 
Methods inherited from class com.atomikos.jms.MessageConsumerSessionPool
getAbstractConnectionFactoryBean, getDaemonThreads, getDestination, getExceptionListener, getMessageListener, getMessageSelector, getNotifyListenerOnClose, getPoolSize, getTransactionTimeout, getUser, setAbstractConnectionFactoryBean, setDaemonThreads, setDestination, setExceptionListener, setMessageListener, setMessageSelector, setNotifyListenerOnClose, setPassword, setPoolSize, setTransactionTimeout, setUser, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TopicSubscriberSessionPool

public TopicSubscriberSessionPool()
Method Detail

createSession

protected MessageConsumerSession createSession()
Specified by:
createSession in class MessageConsumerSessionPool

getTopic

public javax.jms.Topic getTopic()
Gets the topic to listen on.

Returns:

setTopic

public void setTopic(javax.jms.Topic topic)
Sets the topic to listen on (required).

Parameters:
topic -

setTopicConnectionFactoryBean

public void setTopicConnectionFactoryBean(TopicConnectionFactoryBean bean)
Sets the topic connection factory to use (required).

Parameters:
bean -

getTopicConnectionFactoryBean

public TopicConnectionFactoryBean getTopicConnectionFactoryBean()
Gets the topic connection factory.


isNoLocal

public boolean isNoLocal()
Test if this instance will receive sends from the same connection.

Returns:

setNoLocal

public void setNoLocal(boolean noLocal)
Sets whether or not this topic should receive sends from the same connection (optional).

Parameters:
noLocal -

getSubscriberName

public String getSubscriberName()
Gets the subscriber name (for durable subscribers).

Specified by:
getSubscriberName in class MessageConsumerSessionPool
Returns:
The name, or null if not set (no durable subscriber).

setSubscriberName

public void setSubscriberName(String subscriberName)
Sets the name to use for durable subscriptions (optional).
Note: this name will be appended with a suffix to ensure uniqueness among instances in the pool. Otherwise, the JMS back-end would see multiple instances subscribing with the same name - an error.

Parameters:
subscriberName -

getNoLocal

protected boolean getNoLocal()
Specified by:
getNoLocal in class MessageConsumerSessionPool


Copyright © 2011. All Rights Reserved.