org.jboss.resource.adapter.jms.inflow.dlq
Class AbstractDLQHandler

java.lang.Object
  extended byorg.jboss.resource.adapter.jms.inflow.dlq.AbstractDLQHandler
All Implemented Interfaces:
DLQHandler (src) , ExceptionListener (src)
Direct Known Subclasses:
JBossMQDLQHandler (src)

public abstract class AbstractDLQHandler
extends java.lang.Object
implements DLQHandler (src) , ExceptionListener (src)

An abstract DLQ handler.


Field Summary
protected  JmsActivation (src) activation
          The activation
protected  QueueConnection (src) connection
          The DLQ Connection
protected  Queue (src) dlq
          The DLQ
protected static Logger (src) log
          The logger
 
Fields inherited from interface org.jboss.resource.adapter.jms.inflow.DLQHandler (src)
JBOSS_ORIG_DESTINATION, JBOSS_ORIG_MESSAGEID
 
Constructor Summary
AbstractDLQHandler()
           
 
Method Summary
protected  void doSend(Message (src)  msg, int deliveryMode, int priority, long timeToLive)
          Do the message send
protected  int getDeliveryMode(Message (src)  msg)
          Get the delivery mode for the DLQ message
protected  int getPriority(Message (src)  msg)
          Get the priority for the DLQ message
protected  long getTimeToLive(Message (src)  msg)
          Get the time to live for the DLQ message
protected abstract  boolean handleDelivery(Message (src)  msg)
          Do we handle the message?
 boolean handleRedeliveredMessage(Message (src)  msg)
          Check whether the DLQ should handle the message
protected  void handleSendError(Message (src)  msg, java.lang.Throwable t)
          Handle a failure to send the message to the dlq
protected  Message (src) makeWritable(Message (src)  msg)
          Make a writable copy of the message
 void messageDelivered(Message (src)  msg)
          Notification that the message was delivered
 void onException(JMSException (src)  exception)
          Notifies user of a JMS exception.
protected  void sendToDLQ(Message (src)  msg)
          Send the message to the dlq
 void setup(JmsActivation (src)  activation, javax.naming.Context ctx)
          Set up the DLQ
protected  void setupDLQConnection(javax.naming.Context ctx)
          Setup the DLQ Connection
protected  void setupDLQDestination(javax.naming.Context ctx)
          Setup the DLQ Destination
 void teardown()
          Tear down the DLQ
protected  void teardownDLQConnection()
          Teardown the DLQ Connection
protected  void teardownDLQDestination()
          Teardown the DLQ Destination
protected  void warnDLQ(Message (src)  msg, int count, int max)
          Warn that a message is being handled by the DLQ
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final Logger (src)  log
The logger


activation

protected JmsActivation (src)  activation
The activation


dlq

protected Queue (src)  dlq
The DLQ


connection

protected QueueConnection (src)  connection
The DLQ Connection

Constructor Detail

AbstractDLQHandler

public AbstractDLQHandler()
Method Detail

handleRedeliveredMessage

public boolean handleRedeliveredMessage(Message (src)  msg)
Description copied from interface: DLQHandler (src)
Check whether the DLQ should handle the message

Specified by:
handleRedeliveredMessage in interface DLQHandler (src)
Returns:
true if the message is handled and should not be delivered

messageDelivered

public void messageDelivered(Message (src)  msg)
Description copied from interface: DLQHandler (src)
Notification that the message was delivered

Specified by:
messageDelivered in interface DLQHandler (src)

setup

public void setup(JmsActivation (src)  activation,
                  javax.naming.Context ctx)
           throws java.lang.Exception
Description copied from interface: DLQHandler (src)
Set up the DLQ

Specified by:
setup in interface DLQHandler (src)
Parameters:
activation - the activation
Throws:
java.lang.Exception - for any error

teardown

public void teardown()
Description copied from interface: DLQHandler (src)
Tear down the DLQ

Specified by:
teardown in interface DLQHandler (src)

onException

public void onException(JMSException (src)  exception)
Description copied from interface: ExceptionListener (src)
Notifies user of a JMS exception.

Specified by:
onException in interface ExceptionListener (src)
Parameters:
exception - the JMS exception

setupDLQDestination

protected void setupDLQDestination(javax.naming.Context ctx)
                            throws java.lang.Exception
Setup the DLQ Destination

Parameters:
ctx - the naming context
Throws:
java.lang.Exception - for any error

teardownDLQDestination

protected void teardownDLQDestination()
Teardown the DLQ Destination


setupDLQConnection

protected void setupDLQConnection(javax.naming.Context ctx)
                           throws java.lang.Exception
Setup the DLQ Connection

Parameters:
ctx - the naming context
Throws:
java.lang.Exception - for any error

teardownDLQConnection

protected void teardownDLQConnection()
Teardown the DLQ Connection


handleDelivery

protected abstract boolean handleDelivery(Message (src)  msg)
Do we handle the message?

Parameters:
msg - the message to handle
Returns:
true when we handle it

warnDLQ

protected void warnDLQ(Message (src)  msg,
                       int count,
                       int max)
Warn that a message is being handled by the DLQ

Parameters:
msg -
count - the number of redelivers
max - the maximum number of redeliveries

sendToDLQ

protected void sendToDLQ(Message (src)  msg)
Send the message to the dlq


getDeliveryMode

protected int getDeliveryMode(Message (src)  msg)
Get the delivery mode for the DLQ message

Parameters:
msg - the message
Returns:
the delivery mode

getPriority

protected int getPriority(Message (src)  msg)
Get the priority for the DLQ message

Parameters:
msg - the message
Returns:
the priority

getTimeToLive

protected long getTimeToLive(Message (src)  msg)
Get the time to live for the DLQ message

Parameters:
msg - the message
Returns:
the time to live

makeWritable

protected Message (src)  makeWritable(Message (src)  msg)
Make a writable copy of the message

Parameters:
msg - the message
Returns:
the copied message

doSend

protected void doSend(Message (src)  msg,
                      int deliveryMode,
                      int priority,
                      long timeToLive)
Do the message send

Parameters:
msg - the message

handleSendError

protected void handleSendError(Message (src)  msg,
                               java.lang.Throwable t)
Handle a failure to send the message to the dlq

Parameters:
msg - the message
t - the error