org.apache.cocoon.components.jms
Class AbstractMessageListener

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.jms.AbstractMessageListener
All Implemented Interfaces:
MessageListener, Disposable, Initializable, LogEnabled, Parameterizable, Serviceable, JMSConnectionEventListener
Direct Known Subclasses:
JMSEventMessageListener

public abstract class AbstractMessageListener
extends AbstractLogEnabled
implements MessageListener, Serviceable, Parameterizable, Initializable, Disposable, JMSConnectionEventListener

Abstract MessageListener implementation. Use this as a basis for concrete MessageListener implementations. When used in conjunction with the default JMSConnectionManager implementation this class supports automatic reconnection when the connection gets severed.

Parameters:

parameter required/default description
connection required Name of the connection registered with JMSConnectionManager. This must be a topic connection.
topic required The name of the topic to subscribe to.
subscription-id (null) An optional durable subscription id.
message-selector (null) An optional message selector.

Version:
CVS $Id: AbstractMessageListener.html 1304258 2012-03-23 10:09:27Z ilgrosso $

Field Summary
protected  int m_acknowledgeMode
           
protected  String m_connectionName
           
protected  ServiceManager m_manager
           
protected  String m_selector
           
protected  String m_subscriptionId
           
protected  String m_topicName
           
 
Constructor Summary
AbstractMessageListener()
           
 
Method Summary
 void dispose()
           
 void initialize()
          Registers this MessageListener as a TopicSubscriber to the configured Topic.
 void onConnection(String name)
          Called when a JMS connection has been established.
 void onDisconnection(String name)
          Called when a JMS connection is being disconnected.
 void parameterize(Parameters parameters)
           
 void service(ServiceManager manager)
           
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.jms.MessageListener
onMessage
 

Field Detail

m_manager

protected ServiceManager m_manager

m_connectionName

protected String m_connectionName

m_topicName

protected String m_topicName

m_subscriptionId

protected String m_subscriptionId

m_selector

protected String m_selector

m_acknowledgeMode

protected int m_acknowledgeMode
Constructor Detail

AbstractMessageListener

public AbstractMessageListener()
Method Detail

service

public void service(ServiceManager manager)
             throws ServiceException
Specified by:
service in interface Serviceable
Throws:
ServiceException

parameterize

public void parameterize(Parameters parameters)
                  throws ParameterException
Specified by:
parameterize in interface Parameterizable
Throws:
ParameterException

initialize

public void initialize()
                throws Exception
Registers this MessageListener as a TopicSubscriber to the configured Topic.

Specified by:
initialize in interface Initializable
Throws:
Exception

dispose

public void dispose()
Specified by:
dispose in interface Disposable

onConnection

public void onConnection(String name)
Description copied from interface: JMSConnectionEventListener
Called when a JMS connection has been established.

Specified by:
onConnection in interface JMSConnectionEventListener
Parameters:
name - the name of the JMS connection.

onDisconnection

public void onDisconnection(String name)
Description copied from interface: JMSConnectionEventListener
Called when a JMS connection is being disconnected.

Specified by:
onDisconnection in interface JMSConnectionEventListener
Parameters:
name - the name of the JMS connection.


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.