Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.atomikos.jms
Class QueueReceiverSession

    java.lang.Object
      com.atomikos.jms.MessageConsumerSession
          com.atomikos.jms.QueueReceiverSession

    public class QueueReceiverSession

extends MessageConsumerSession

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 com.atomikos.jms.MessageConsumerSession
`getAbstractConnectionFactoryBean, getDaemonThreads, getDestination, getExceptionListener, getMessageListener, getMessageSelector, getNotifyListenerOnClose, getTransactionTimeout, getUser, setAbstractConnectionFactoryBean, setDaemonThreads, setDestination, setExceptionListener, setMessageListener, setMessageSelector, setNotifyListenerOnClose, setPassword, setTransactionTimeout, setUser, startListening, startNewThread, stopListening`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### QueueReceiverSession

    public QueueReceiverSession()

  Create a new instance. Configuration should be done via the setters.

Method Detail

### setQueueConnectionFactoryBean

    public void setQueueConnectionFactoryBean(QueueConnectionFactoryBean factory)

  Set the queue connection factory to use.

  Parameters:
    `factory` - The queue connection factory. This factory needs to be configured independently before this method is called.

### getQueueConnectionFactoryBean

    public QueueConnectionFactoryBean getQueueConnectionFactoryBean()

  Get the queue connection factory.

  Returns:

### setQueue

    public void setQueue(javax.jms.Queue queue)

  Set the queue to use for listening on.

  Parameters:
    `queue` - This is the queue where messages are to be taken off transactionally.

### getQueue

    public javax.jms.Queue getQueue()

  Get the queue.

  Returns:

### getDestinationName

    protected String getDestinationName()

  Specified by:
    `getDestinationName` in class `MessageConsumerSession`

### getNoLocal

    protected boolean getNoLocal()

  Specified by:
    `getNoLocal` in class `MessageConsumerSession`

### getSubscriberName

    protected String getSubscriberName()

  Specified by:
    `getSubscriberName` in class `MessageConsumerSession`

### setNoLocal

    protected void setNoLocal(boolean value)

  Specified by:
    `setNoLocal` in class `MessageConsumerSession`

### setSubscriberName

    protected void setSubscriberName(String name)

  Specified by:
    `setSubscriberName` in class `MessageConsumerSession`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012. All Rights Reserved.