JBoss API: Class DLQHandler

org.jboss.ejb.plugins.jms
Class DLQHandler

java.lang.Object
  |
  +--org.jboss.ejb.plugins.jms.DLQHandler

public class DLQHandler
extends java.lang.Object

Places redeliveded messages on a Dead Letter Queue.

The Dead Letter Queue handler is used to not set JBoss in an endles loop when a message is resent on and on due to transaction rollback for message receipt.

It sends message to a dead letter queue (configurable, defaults to queue/DLQ) when the message has been resent a configurable amount of times, defaults to 10.

The handler is configured through the element MDBConfig in container-invoker-conf.

The JMS property JBOSS_ORIG_DESTINATION in the resent message is set to the name of the original destination (Destionation.toString()).

The JMS property JBOSS_ORIG_MESSAGEID in the resent message is set to the id of the original message. Created: Thu Aug 23 21:17:26 2001

Version:
$Revision: 1.4.2.1 $ $Date: 2001/12/16 02:00:13 $
Author:
 

Field Summary
static java.lang.String JBOSS_ORIG_DESTINATION
          JMS property name holding original destination.
static java.lang.String JBOSS_ORIG_MESSAGEID
          JMS property name holding original JMS message id.
 
Constructor Summary
DLQHandler()
           
 
Method Summary
protected  void deleteFromBuffer(java.lang.String id)
          Delete the entry in the message counter buffer for specifyed JMS id.
 boolean handleRedeliveredMessage(javax.jms.Message msg)
          Check if a message has been redelivered to many times.
 void importXml(org.w3c.dom.Element element)
          Takes an MDBConfig Element
protected  int incrementResentCount(java.lang.String id)
          Increment the counter for the specific JMS message id.
protected  javax.jms.Message makeWritable(javax.jms.Message msg)
          Make the Message properties writable.
protected  void sendMessage(javax.jms.Message msg)
          Send message to the configured dead letter queue, defaults to queue/DLQ.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

JBOSS_ORIG_DESTINATION

public static final java.lang.String JBOSS_ORIG_DESTINATION
JMS property name holding original destination.

JBOSS_ORIG_MESSAGEID

public static final java.lang.String JBOSS_ORIG_MESSAGEID
JMS property name holding original JMS message id.
Constructor Detail

DLQHandler

public DLQHandler()
Method Detail

handleRedeliveredMessage

public boolean handleRedeliveredMessage(javax.jms.Message msg)
Check if a message has been redelivered to many times. If message has been redelivered to many times, send it to the dead letter queue (default to queue/DLQ).
Returns:
true if message is handled, i.e resent, false if not.

incrementResentCount

protected int incrementResentCount(java.lang.String id)
Increment the counter for the specific JMS message id.
Returns:
the new counter value.

deleteFromBuffer

protected void deleteFromBuffer(java.lang.String id)
Delete the entry in the message counter buffer for specifyed JMS id.

sendMessage

protected void sendMessage(javax.jms.Message msg)
                    throws javax.jms.JMSException
Send message to the configured dead letter queue, defaults to queue/DLQ.

makeWritable

protected javax.jms.Message makeWritable(javax.jms.Message msg)
                                  throws javax.jms.JMSException
Make the Message properties writable.
Returns:
the writable message.

importXml

public void importXml(org.w3c.dom.Element element)
               throws DeploymentException
Takes an MDBConfig Element

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2000 The JBoss Organization. All Rights Reserved.