Class UimaDefaultMessageListenerContainer
- java.lang.Object
-
- org.springframework.jms.support.JmsAccessor
-
- org.springframework.jms.support.destination.JmsDestinationAccessor
-
- org.springframework.jms.listener.AbstractJmsListeningContainer
-
- org.springframework.jms.listener.AbstractMessageListenerContainer
-
- org.springframework.jms.listener.AbstractPollingMessageListenerContainer
-
- org.springframework.jms.listener.DefaultMessageListenerContainer
-
- org.apache.uima.adapter.jms.activemq.UimaDefaultMessageListenerContainer
-
- All Implemented Interfaces:
javax.jms.ExceptionListener,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.InitializingBean,org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle,org.springframework.jms.listener.MessageListenerContainer
public class UimaDefaultMessageListenerContainer extends org.springframework.jms.listener.DefaultMessageListenerContainer implements javax.jms.ExceptionListener
-
-
Field Summary
Fields Modifier and Type Field Description static booleanterminating-
Fields inherited from class org.springframework.jms.listener.DefaultMessageListenerContainer
CACHE_AUTO, CACHE_CONNECTION, CACHE_CONSUMER, CACHE_NONE, CACHE_SESSION, DEFAULT_RECOVERY_INTERVAL, DEFAULT_THREAD_NAME_PREFIX
-
Fields inherited from class org.springframework.jms.listener.AbstractPollingMessageListenerContainer
DEFAULT_RECEIVE_TIMEOUT
-
Fields inherited from class org.springframework.jms.listener.AbstractJmsListeningContainer
lifecycleMonitor, sharedConnectionMonitor
-
-
Constructor Summary
Constructors Constructor Description UimaDefaultMessageListenerContainer()UimaDefaultMessageListenerContainer(boolean freeCasQueueListener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()voidafterPropertiesSet(boolean propagate)Called by Spring and some Uima AS components when all properties have been set.voidcloseConnection()Closes shares connection to a brokervoiddelegateStop()voiddestroy()Spins a shutdown thread and stops Sprint and ActiveMQ threads.voiddoDestroy()Delegate shutdown to the super classjava.lang.StringgetBrokerUrl()java.lang.StringgetDestinationName()java.lang.StringgetEndpointName()javax.jms.DestinationgetListenerEndpoint()org.springframework.core.task.TaskExecutorgetTaskExecutor()protected voidhandleListenerException(java.lang.Throwable t)protected voidhandleListenerSetupFailure(java.lang.Throwable t, boolean alreadyHandled)This method is called by Spring when a listener failsvoidinitializeContainer()booleanisFreeCasQueueListener()voidonException(javax.jms.JMSException arg0)protected voidrecoverAfterListenerSetupFailure()protected voidrefreshConnectionUntilSuccessful()Overriden Spring's method that tries to recover from lost connection.voidsetConcurrentConsumers(int concurrentConsumers)Intercept Spring call to increment number of consumer threads.voidsetConnectionFactory(javax.jms.ConnectionFactory aConnectionFactory)voidsetController(AnalysisEngineController aController)voidsetDestination(javax.jms.Destination aDestination)voidsetDestinationResolver(org.springframework.jms.support.destination.DestinationResolver resolver)voidsetMessageListener(java.lang.Object messageListener)Intercept Spring call to inject application Pojo listener.voidsetMessageSelector(java.lang.String messageSelector)protected voidsetModifiedTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)voidsetTargetEndpoint(Endpoint anEndpoint)voidsetTaskExecutor(org.springframework.core.task.TaskExecutor aTaskExecutor)Called by Spring to inject TaskExecutorvoidsetTerminating()voidshutdownTaskExecutor(java.util.concurrent.ThreadPoolExecutor tpe)voidstop()-
Methods inherited from class org.springframework.jms.listener.DefaultMessageListenerContainer
applyBackOffTime, createDefaultTaskExecutor, doInitialize, doRescheduleTask, doShutdown, establishSharedConnection, getActiveConsumerCount, getCacheLevel, getConcurrentConsumers, getIdleConsumerLimit, getIdleTaskExecutionLimit, getMaxConcurrentConsumers, getMaxMessagesPerTask, getScheduledConsumerCount, initialize, isRecovering, isRegisteredWithDestination, messageReceived, noMessageReceived, refreshDestination, scheduleNewInvokerIfAppropriate, setBackOff, setCacheLevel, setCacheLevelName, setConcurrency, setIdleConsumerLimit, setIdleTaskExecutionLimit, setMaxConcurrentConsumers, setMaxMessagesPerTask, setRecoveryInterval, setTaskExecutor, sharedConnectionEnabled, start, startSharedConnection, stop, stopSharedConnection
-
Methods inherited from class org.springframework.jms.listener.AbstractPollingMessageListenerContainer
createListenerConsumer, doReceiveAndExecute, getConnection, getReceiveTimeout, getSession, getTransactionManager, isSessionLocallyTransacted, receiveAndExecute, receiveMessage, setReceiveTimeout, setSessionTransacted, setTransactionManager, setTransactionName, setTransactionTimeout, shouldCommitAfterNoMessageReceived
-
Methods inherited from class org.springframework.jms.listener.AbstractMessageListenerContainer
checkMessageListener, commitIfNecessary, createConsumer, doExecuteListener, doInvokeListener, doInvokeListener, executeListener, getDefaultSubscriptionName, getDestination, getDestinationDescription, getDurableSubscriptionName, getErrorHandler, getExceptionListener, getMessageConverter, getMessageListener, getMessageSelector, getSubscriptionName, invokeErrorHandler, invokeExceptionListener, invokeListener, isAcceptMessagesWhileStopping, isExposeListenerSession, isPubSubNoLocal, isReplyPubSubDomain, isSubscriptionDurable, isSubscriptionShared, rollbackIfNecessary, rollbackOnExceptionIfNecessary, setAcceptMessagesWhileStopping, setDestinationName, setDurableSubscriptionName, setErrorHandler, setExceptionListener, setExposeListenerSession, setMessageConverter, setPubSubNoLocal, setReplyPubSubDomain, setSubscriptionDurable, setSubscriptionName, setSubscriptionShared, setupMessageListener, validateConfiguration
-
Methods inherited from class org.springframework.jms.listener.AbstractJmsListeningContainer
createSharedConnection, doStart, doStop, getBeanName, getClientId, getPausedTaskCount, getPhase, getSharedConnection, isActive, isAutoStartup, isRunning, logRejectedTask, prepareSharedConnection, refreshSharedConnection, rescheduleTaskIfNecessary, resumePausedTasks, runningAllowed, setAutoStartup, setBeanName, setClientId, setPhase, shutdown
-
Methods inherited from class org.springframework.jms.support.destination.JmsDestinationAccessor
getDestinationResolver, isPubSubDomain, receiveFromConsumer, resolveDestinationName, setPubSubDomain
-
Methods inherited from class org.springframework.jms.support.JmsAccessor
convertJmsAccessException, createConnection, createSession, getConnectionFactory, getSessionAcknowledgeMode, isClientAcknowledge, isSessionTransacted, setSessionAcknowledgeMode, setSessionAcknowledgeModeName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Method Detail
-
refreshConnectionUntilSuccessful
protected void refreshConnectionUntilSuccessful()
Overriden Spring's method that tries to recover from lost connection. We dont want to recover when the service is stopping.- Overrides:
refreshConnectionUntilSuccessfulin classorg.springframework.jms.listener.DefaultMessageListenerContainer
-
recoverAfterListenerSetupFailure
protected void recoverAfterListenerSetupFailure()
- Overrides:
recoverAfterListenerSetupFailurein classorg.springframework.jms.listener.DefaultMessageListenerContainer
-
setTerminating
public void setTerminating()
-
setController
public void setController(AnalysisEngineController aController)
-
handleListenerSetupFailure
protected void handleListenerSetupFailure(java.lang.Throwable t, boolean alreadyHandled)This method is called by Spring when a listener fails- Overrides:
handleListenerSetupFailurein classorg.springframework.jms.listener.DefaultMessageListenerContainer
-
handleListenerException
protected void handleListenerException(java.lang.Throwable t)
- Overrides:
handleListenerExceptionin classorg.springframework.jms.listener.AbstractMessageListenerContainer
-
initializeContainer
public void initializeContainer()
-
setConcurrentConsumers
public void setConcurrentConsumers(int concurrentConsumers)
Intercept Spring call to increment number of consumer threads. If the value > 1, don't propagate to Spring. A new listener will be injected and it will use provided number of consumer threads.- Overrides:
setConcurrentConsumersin classorg.springframework.jms.listener.DefaultMessageListenerContainer
-
setMessageListener
public void setMessageListener(java.lang.Object messageListener)
Intercept Spring call to inject application Pojo listener. Don't propagate the listener up to Spring just yet. If more than one consumer thread is used, a different listener will be injected.- Overrides:
setMessageListenerin classorg.springframework.jms.listener.AbstractMessageListenerContainer
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Overrides:
afterPropertiesSetin classorg.springframework.jms.listener.AbstractJmsListeningContainer
-
afterPropertiesSet
public void afterPropertiesSet(boolean propagate)
Called by Spring and some Uima AS components when all properties have been set. This method spins a thread in which the listener is initialized.
-
getDestinationName
public java.lang.String getDestinationName()
- Overrides:
getDestinationNamein classorg.springframework.jms.listener.AbstractMessageListenerContainer
-
getEndpointName
public java.lang.String getEndpointName()
-
getBrokerUrl
public java.lang.String getBrokerUrl()
-
setConnectionFactory
public void setConnectionFactory(javax.jms.ConnectionFactory aConnectionFactory)
- Overrides:
setConnectionFactoryin classorg.springframework.jms.support.JmsAccessor
-
setDestinationResolver
public void setDestinationResolver(org.springframework.jms.support.destination.DestinationResolver resolver)
- Overrides:
setDestinationResolverin classorg.springframework.jms.support.destination.JmsDestinationAccessor
-
closeConnection
public void closeConnection() throws java.lang.ExceptionCloses shares connection to a broker- Throws:
java.lang.Exception
-
setDestination
public void setDestination(javax.jms.Destination aDestination)
- Overrides:
setDestinationin classorg.springframework.jms.listener.AbstractMessageListenerContainer
-
getListenerEndpoint
public javax.jms.Destination getListenerEndpoint()
-
onException
public void onException(javax.jms.JMSException arg0)
- Specified by:
onExceptionin interfacejavax.jms.ExceptionListener
-
setTargetEndpoint
public void setTargetEndpoint(Endpoint anEndpoint)
-
isFreeCasQueueListener
public boolean isFreeCasQueueListener()
-
setModifiedTaskExecutor
protected void setModifiedTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
-
doDestroy
public void doDestroy()
Delegate shutdown to the super class
-
setMessageSelector
public void setMessageSelector(java.lang.String messageSelector)
- Overrides:
setMessageSelectorin classorg.springframework.jms.listener.AbstractMessageListenerContainer
-
shutdownTaskExecutor
public void shutdownTaskExecutor(java.util.concurrent.ThreadPoolExecutor tpe) throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
destroy
public void destroy()
Spins a shutdown thread and stops Sprint and ActiveMQ threads.- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean- Overrides:
destroyin classorg.springframework.jms.listener.AbstractJmsListeningContainer
-
setTaskExecutor
public void setTaskExecutor(org.springframework.core.task.TaskExecutor aTaskExecutor)
Called by Spring to inject TaskExecutor
-
getTaskExecutor
public org.springframework.core.task.TaskExecutor getTaskExecutor()
-
delegateStop
public void delegateStop()
-
stop
public void stop() throws org.springframework.jms.JmsException- Specified by:
stopin interfaceorg.springframework.context.Lifecycle- Overrides:
stopin classorg.springframework.jms.listener.AbstractJmsListeningContainer- Throws:
org.springframework.jms.JmsException
-
-