org.apache.uima.adapter.jms.activemq
Class JmsInputChannel

java.lang.Object
  extended by org.apache.uima.adapter.jms.activemq.JmsInputChannel
All Implemented Interfaces:
Serializable, org.apache.uima.aae.Channel, org.apache.uima.aae.InputChannel, JmsInputChannelMBean, org.springframework.jms.listener.SessionAwareMessageListener

public class JmsInputChannel
extends Object
implements org.apache.uima.aae.InputChannel, JmsInputChannelMBean, org.springframework.jms.listener.SessionAwareMessageListener

Thin adapter for receiving JMS messages from Spring. It delegates processing of all messages to the Handler. Each JMS Message is wrapped in transport neutral MessageContext wrapper.

See Also:
Serialized Form

Field Summary
static boolean attachToBrokerMBeanServer
           
 
Fields inherited from interface org.apache.uima.aae.Channel
CloseAllChannels, InputChannels
 
Constructor Summary
JmsInputChannel()
           
 
Method Summary
 void abort()
           
 void ackMessage(org.apache.uima.aae.message.MessageContext aMessageContext)
           
 void createListener(String aDelegateKey, org.apache.uima.aae.controller.Endpoint endpointToUpdate)
           
 void destroyListener(String anEndpointName, String aDelegateKey)
           
 String getBrokerURL()
           
 int getConcurrentConsumerCount()
           
 org.apache.activemq.ActiveMQConnectionFactory getConnectionFactory()
           
 org.apache.uima.aae.controller.AnalysisEngineController getController()
           
 String getInputQueueName()
           
 String getName()
           
 String getServerUri()
           
 org.apache.uima.aae.jmx.ServiceInfo getServiceInfo()
           
 int getSessionAckMode()
           
 boolean isFailed(String aDelegateKey)
           
 boolean isListenerActiveOnDestination(javax.jms.Destination destination)
           
 boolean isListenerForDestination(String anEndpointName)
           
 boolean isStopped()
           
 void onMessage(javax.jms.Message aMessage, javax.jms.Session aJmsSession)
          Receives Messages from the JMS Provider.
 void removeDelegateFromFailedList(String aDelegateKey)
           
 void setController(org.apache.uima.aae.controller.AnalysisEngineController aController)
           
 void setEndpointName(String anEndpointName)
           
 void setListenerContainer(UimaDefaultMessageListenerContainer messageListener)
           
 void setMessageHandler(org.apache.uima.aae.handler.Handler aHandler)
           
 void setServerUri(String serverUri)
           
 void setTerminating()
           
 void stop()
           
 void stop(int channelsToClose)
           
 void terminate()
           
 boolean validMessage(javax.jms.Message aMessage)
          Validates contents of the message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attachToBrokerMBeanServer

public static transient boolean attachToBrokerMBeanServer
Constructor Detail

JmsInputChannel

public JmsInputChannel()
Method Detail

getController

public org.apache.uima.aae.controller.AnalysisEngineController getController()

getName

public String getName()
Specified by:
getName in interface org.apache.uima.aae.Channel

setController

public void setController(org.apache.uima.aae.controller.AnalysisEngineController aController)
                   throws Exception
Throws:
Exception

setMessageHandler

public void setMessageHandler(org.apache.uima.aae.handler.Handler aHandler)

setEndpointName

public void setEndpointName(String anEndpointName)

validMessage

public boolean validMessage(javax.jms.Message aMessage)
                     throws Exception
Validates contents of the message. It checks if command, payload and message types contain valid data.

Parameters:
aMessage - - JMS Message to validate
Returns:
- true if message is valid, false otherwise
Throws:
Exception

abort

public void abort()

onMessage

public void onMessage(javax.jms.Message aMessage,
                      javax.jms.Session aJmsSession)
Receives Messages from the JMS Provider. It checks the message header to determine the type of message received. Based on the type, a MessageContext is created to facilitate access to the transport specific message. Once the MessageContext is determined this routine delegates handling of the message to the chain of MessageHandlers.

Specified by:
onMessage in interface org.springframework.jms.listener.SessionAwareMessageListener
Parameters:
aMessage - - JMS Message containing header and payload
aJmsSession - - JMSSession object

getSessionAckMode

public int getSessionAckMode()
Specified by:
getSessionAckMode in interface org.apache.uima.aae.InputChannel

getServerUri

public String getServerUri()
Specified by:
getServerUri in interface org.apache.uima.aae.InputChannel

setListenerContainer

public void setListenerContainer(UimaDefaultMessageListenerContainer messageListener)

getConnectionFactory

public org.apache.activemq.ActiveMQConnectionFactory getConnectionFactory()

ackMessage

public void ackMessage(org.apache.uima.aae.message.MessageContext aMessageContext)
Specified by:
ackMessage in interface org.apache.uima.aae.InputChannel

getBrokerURL

public String getBrokerURL()
Specified by:
getBrokerURL in interface JmsInputChannelMBean

getInputQueueName

public String getInputQueueName()
Specified by:
getInputQueueName in interface org.apache.uima.aae.InputChannel
Specified by:
getInputQueueName in interface JmsInputChannelMBean

getServiceInfo

public org.apache.uima.aae.jmx.ServiceInfo getServiceInfo()
Specified by:
getServiceInfo in interface org.apache.uima.aae.InputChannel

setServerUri

public void setServerUri(String serverUri)
Specified by:
setServerUri in interface org.apache.uima.aae.InputChannel

stop

public void stop()
          throws Exception
Specified by:
stop in interface org.apache.uima.aae.Channel
Throws:
Exception

setTerminating

public void setTerminating()
Specified by:
setTerminating in interface org.apache.uima.aae.InputChannel

terminate

public void terminate()
Specified by:
terminate in interface org.apache.uima.aae.InputChannel

stop

public void stop(int channelsToClose)
          throws Exception
Specified by:
stop in interface org.apache.uima.aae.Channel
Throws:
Exception

isStopped

public boolean isStopped()
Specified by:
isStopped in interface org.apache.uima.aae.InputChannel

getConcurrentConsumerCount

public int getConcurrentConsumerCount()
Specified by:
getConcurrentConsumerCount in interface org.apache.uima.aae.InputChannel

createListener

public void createListener(String aDelegateKey,
                           org.apache.uima.aae.controller.Endpoint endpointToUpdate)
                    throws Exception
Specified by:
createListener in interface org.apache.uima.aae.InputChannel
Throws:
Exception

isListenerActiveOnDestination

public boolean isListenerActiveOnDestination(javax.jms.Destination destination)

destroyListener

public void destroyListener(String anEndpointName,
                            String aDelegateKey)
Specified by:
destroyListener in interface org.apache.uima.aae.InputChannel

isFailed

public boolean isFailed(String aDelegateKey)
Specified by:
isFailed in interface org.apache.uima.aae.InputChannel

removeDelegateFromFailedList

public void removeDelegateFromFailedList(String aDelegateKey)
Specified by:
removeDelegateFromFailedList in interface org.apache.uima.aae.InputChannel

isListenerForDestination

public boolean isListenerForDestination(String anEndpointName)
Specified by:
isListenerForDestination in interface org.apache.uima.aae.InputChannel


Copyright © 2006-2011 The Apache Software Foundation. All Rights Reserved.