org.apache.cocoon.caching.impl
Class JMSEventMessageListener

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

public class JMSEventMessageListener
extends AbstractMessageListener
implements ThreadSafe

JMS listener will notify an EventAware component of external events. This could be used for example to do external cache invalidation.

Besides those inherited from AbstractMessageListener parameters are:

parameter required default description
eventcache-role no org.apache.cocoon.caching.Cache/EventAware The role name to lookup the event cache from the service manager.


Field Summary
 
Fields inherited from class org.apache.cocoon.components.jms.AbstractMessageListener
m_acknowledgeMode, m_connectionName, m_manager, m_selector, m_subscriptionId, m_topicName
 
Constructor Summary
JMSEventMessageListener()
           
 
Method Summary
 void dispose()
           
protected  Event[] eventsFromMessage(Message message)
          Convert the message contents to (a series of) cache event.
 void initialize()
          Registers this MessageListener as a TopicSubscriber to the configured Topic.
 void onMessage(Message message)
          Notifies the event cache of events occurred.
 void parameterize(Parameters parameters)
           
 
Methods inherited from class org.apache.cocoon.components.jms.AbstractMessageListener
onConnection, onDisconnection, service
 
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
 

Constructor Detail

JMSEventMessageListener

public JMSEventMessageListener()
Method Detail

parameterize

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

initialize

public void initialize()
                throws Exception
Description copied from class: AbstractMessageListener
Registers this MessageListener as a TopicSubscriber to the configured Topic.

Specified by:
initialize in interface Initializable
Overrides:
initialize in class AbstractMessageListener
Throws:
Exception

dispose

public void dispose()
Specified by:
dispose in interface Disposable
Overrides:
dispose in class AbstractMessageListener

onMessage

public void onMessage(Message message)
Notifies the event cache of events occurred.

Specified by:
onMessage in interface MessageListener

eventsFromMessage

protected Event[] eventsFromMessage(Message message)
Convert the message contents to (a series of) cache event. The default implementation assumes that the message contains the trigger name, a '|', and a table name. It extracts the tablename and creates a NamedEvent with it. Override this method to provide a custom message to event mapping.

Parameters:
message - the JMS message.
Returns:
the cache event.


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