org.activemq.util
Class MessageListenerSupport

java.lang.Object
  extended byorg.activemq.util.MessageListenerSupport
All Implemented Interfaces:
MessageListener

public abstract class MessageListenerSupport
extends Object
implements MessageListener

A helper base class which makes writing message listeners easier without having to worry about handling the JMSException on the onMessage() method. By default the JMS ExceptionListener will be used to handle any JMS exceptions or if none is configured then a runtime exception will be generated.

Version:
$Revision: 1.1.1.1 $
Author:
James Strachan

Constructor Summary
MessageListenerSupport()
           
 
Method Summary
 ExceptionListener getExceptionListener()
           
protected  void onJMSException(JMSException e, Message message)
          Process the JMS exception either by calling an exception listener which can contian custom logic or by throwing a runtime exception
 void onMessage(Message message)
           
protected abstract  void processMessage(Message messsage)
          This method processes the incoming message possibly throwing a JMSException if the message could not be processed correctly.
 void setExceptionListener(ExceptionListener exceptionListener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageListenerSupport

public MessageListenerSupport()
Method Detail

onMessage

public void onMessage(Message message)
Specified by:
onMessage in interface MessageListener

getExceptionListener

public ExceptionListener getExceptionListener()

setExceptionListener

public void setExceptionListener(ExceptionListener exceptionListener)

processMessage

protected abstract void processMessage(Message messsage)
                                throws Exception
This method processes the incoming message possibly throwing a JMSException if the message could not be processed correctly.

Parameters:
messsage -
Throws:
Exception

onJMSException

protected void onJMSException(JMSException e,
                              Message message)
Process the JMS exception either by calling an exception listener which can contian custom logic or by throwing a runtime exception

Parameters:
e -
message -


Copyright © 2004-2007 Protique, Ltd.. All Rights Reserved.