org.rutil.jms
Class RetryMessageListener
java.lang.Object
org.rutil.jms.RetryMessageListener
- All Implemented Interfaces:
- org.springframework.jms.listener.SessionAwareMessageListener
public abstract class RetryMessageListener
- extends java.lang.Object
- implements org.springframework.jms.listener.SessionAwareMessageListener
This implementation of SessionAwareMessageListener provides the following.
1. Provider independent retry feature (by using this jms header: "retry.count")
2. On failure (i.e. when a requeue exception is thrown by handleMessage) messages are enqueued
to the end of the queue so that processing is not stuck with the same message (caused by rollback).
3. Once the retry count has exceeded configured maximum, the message is sent to dead letter queue.
- Author:
- mohan
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RetryMessageListener
protected RetryMessageListener()
getMaxRetries
public int getMaxRetries()
setMaxRetries
public void setMaxRetries(int maxRetries)
getQueueName
public java.lang.String getQueueName()
setQueueName
public void setQueueName(java.lang.String queueName)
getDeadLetterQueueName
public java.lang.String getDeadLetterQueueName()
setDeadLetterQueueName
public void setDeadLetterQueueName(java.lang.String deadLetterQueueName)
onMessage
public void onMessage(javax.jms.Message message,
javax.jms.Session session)
throws javax.jms.JMSException
- Specified by:
onMessage in interface org.springframework.jms.listener.SessionAwareMessageListener
- Throws:
javax.jms.JMSException
getRetriedCount
protected int getRetriedCount(javax.jms.Message message)
makeMessageWritable
protected void makeMessageWritable(javax.jms.Message message)
throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
handleMessage
protected abstract void handleMessage(javax.jms.Message message,
javax.jms.Session session)
throws RequeueException,
javax.jms.JMSException
- Throws:
RequeueException
javax.jms.JMSException