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

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

public class JmsInputChannel
extends java.lang.Object
implements 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(MessageContext aMessageContext)
           
 void createListener(java.lang.String aDelegateKey, Endpoint endpointToUpdate)
           
 void destroyListener(java.lang.String anEndpointName, java.lang.String aDelegateKey)
           
 java.lang.String getBrokerURL()
           
 int getConcurrentConsumerCount()
           
 org.apache.activemq.ActiveMQConnectionFactory getConnectionFactory()
           
 AnalysisEngineController getController()
           
 java.lang.String getInputQueueName()
           
 java.lang.String getName()
           
 java.lang.String getServerUri()
           
 ServiceInfo getServiceInfo()
           
 int getSessionAckMode()
           
 boolean isFailed(java.lang.String aDelegateKey)
           
 boolean isListenerActiveOnDestination(javax.jms.Destination destination)
           
 boolean isListenerForDestination(java.lang.String anEndpointName)
           
 boolean isStopped()
           
 void onMessage(javax.jms.Message aMessage, javax.jms.Session aJmsSession)
          Receives Messages from the JMS Provider.
 void removeDelegateFromFailedList(java.lang.String aDelegateKey)
           
 void setController(AnalysisEngineController aController)
           
 void setEndpointName(java.lang.String anEndpointName)
           
 void setListenerContainer(UimaDefaultMessageListenerContainer messageListener)
           
 void setMessageHandler(Handler aHandler)
           
 void setServerUri(java.lang.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 AnalysisEngineController getController()

getName

public java.lang.String getName()
Specified by:
getName in interface Channel

setController

public void setController(AnalysisEngineController aController)
                   throws java.lang.Exception
Throws:
java.lang.Exception

setMessageHandler

public void setMessageHandler(Handler aHandler)

setEndpointName

public void setEndpointName(java.lang.String anEndpointName)

validMessage

public boolean validMessage(javax.jms.Message aMessage)
                     throws java.lang.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:
java.lang.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 InputChannel

getServerUri

public java.lang.String getServerUri()
Specified by:
getServerUri in interface InputChannel

setListenerContainer

public void setListenerContainer(UimaDefaultMessageListenerContainer messageListener)

getConnectionFactory

public org.apache.activemq.ActiveMQConnectionFactory getConnectionFactory()

ackMessage

public void ackMessage(MessageContext aMessageContext)
Specified by:
ackMessage in interface InputChannel

getBrokerURL

public java.lang.String getBrokerURL()
Specified by:
getBrokerURL in interface JmsInputChannelMBean

getInputQueueName

public java.lang.String getInputQueueName()
Specified by:
getInputQueueName in interface InputChannel
Specified by:
getInputQueueName in interface JmsInputChannelMBean

getServiceInfo

public ServiceInfo getServiceInfo()
Specified by:
getServiceInfo in interface InputChannel

setServerUri

public void setServerUri(java.lang.String serverUri)
Specified by:
setServerUri in interface InputChannel

stop

public void stop()
          throws java.lang.Exception
Specified by:
stop in interface Channel
Throws:
java.lang.Exception

setTerminating

public void setTerminating()
Specified by:
setTerminating in interface InputChannel

terminate

public void terminate()
Specified by:
terminate in interface InputChannel

stop

public void stop(int channelsToClose)
          throws java.lang.Exception
Specified by:
stop in interface Channel
Throws:
java.lang.Exception

isStopped

public boolean isStopped()
Specified by:
isStopped in interface InputChannel

getConcurrentConsumerCount

public int getConcurrentConsumerCount()
Specified by:
getConcurrentConsumerCount in interface InputChannel

createListener

public void createListener(java.lang.String aDelegateKey,
                           Endpoint endpointToUpdate)
                    throws java.lang.Exception
Specified by:
createListener in interface InputChannel
Throws:
java.lang.Exception

isListenerActiveOnDestination

public boolean isListenerActiveOnDestination(javax.jms.Destination destination)

destroyListener

public void destroyListener(java.lang.String anEndpointName,
                            java.lang.String aDelegateKey)
Specified by:
destroyListener in interface InputChannel

isFailed

public boolean isFailed(java.lang.String aDelegateKey)
Specified by:
isFailed in interface InputChannel

removeDelegateFromFailedList

public void removeDelegateFromFailedList(java.lang.String aDelegateKey)
Specified by:
removeDelegateFromFailedList in interface InputChannel

isListenerForDestination

public boolean isListenerForDestination(java.lang.String anEndpointName)
Specified by:
isListenerForDestination in interface InputChannel


Copyright © 2012. All Rights Reserved.