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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.jms.listener.AbstractJmsListeningContainer
org.springframework.jms.listener.AbstractJmsListeningContainer.SharedConnectionNotInitializedException -
Field Summary
FieldsFields inherited from class org.springframework.jms.listener.DefaultMessageListenerContainer
CACHE_AUTO, CACHE_CONNECTION, CACHE_CONSUMER, CACHE_NONE, CACHE_SESSION, DEFAULT_RECOVERY_INTERVAL, DEFAULT_THREAD_NAME_PREFIXFields inherited from class org.springframework.jms.listener.AbstractPollingMessageListenerContainer
DEFAULT_RECEIVE_TIMEOUTFields inherited from class org.springframework.jms.listener.AbstractJmsListeningContainer
lifecycleMonitor, sharedConnectionMonitorFields inherited from class org.springframework.jms.support.destination.JmsDestinationAccessor
RECEIVE_TIMEOUT_INDEFINITE_WAIT, RECEIVE_TIMEOUT_NO_WAITFields inherited from class org.springframework.jms.support.JmsAccessor
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidafterPropertiesSet(boolean propagate) Called by Spring and some Uima AS components when all properties have been set.voidCloses shares connection to a brokervoidvoiddestroy()Spins a shutdown thread and stops Sprint and ActiveMQ threads.voidDelegate shutdown to the super classjavax.jms.Destinationorg.springframework.core.task.TaskExecutorprotected voidprotected voidhandleListenerSetupFailure(Throwable t, boolean alreadyHandled) This method is called by Spring when a listener failsvoidbooleanvoidonException(javax.jms.JMSException arg0) protected voidprotected voidOverriden 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(Object messageListener) Intercept Spring call to inject application Pojo listener.voidsetMessageSelector(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 TaskExecutorvoidvoidvoidstop()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, stopSharedConnectionMethods inherited from class org.springframework.jms.listener.AbstractPollingMessageListenerContainer
createListenerConsumer, doReceiveAndExecute, getConnection, getReceiveTimeout, getSession, getTransactionManager, isSessionLocallyTransacted, receiveAndExecute, receiveMessage, setReceiveTimeout, setSessionTransacted, setTransactionManager, setTransactionName, setTransactionTimeout, shouldCommitAfterNoMessageReceivedMethods 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, validateConfigurationMethods 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, shutdownMethods inherited from class org.springframework.jms.support.destination.JmsDestinationAccessor
getDestinationResolver, isPubSubDomain, receiveFromConsumer, resolveDestinationName, setPubSubDomainMethods inherited from class org.springframework.jms.support.JmsAccessor
convertJmsAccessException, createConnection, createSession, getConnectionFactory, getSessionAcknowledgeMode, isClientAcknowledge, isSessionTransacted, setSessionAcknowledgeMode, setSessionAcknowledgeModeNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.Lifecycle
isRunningMethods inherited from interface org.springframework.jms.listener.MessageListenerContainer
getDestinationResolver, isPubSubDomainMethods inherited from interface org.springframework.context.Phased
getPhaseMethods inherited from interface org.springframework.context.SmartLifecycle
isAutoStartup
-
Field Details
-
terminating
public static volatile boolean terminating
-
-
Constructor Details
-
UimaDefaultMessageListenerContainer
public UimaDefaultMessageListenerContainer() -
UimaDefaultMessageListenerContainer
public UimaDefaultMessageListenerContainer(boolean freeCasQueueListener)
-
-
Method Details
-
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
-
handleListenerSetupFailure
This method is called by Spring when a listener fails- Overrides:
handleListenerSetupFailurein classorg.springframework.jms.listener.DefaultMessageListenerContainer
-
handleListenerException
- 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
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
- Overrides:
getDestinationNamein classorg.springframework.jms.listener.AbstractMessageListenerContainer
-
getEndpointName
-
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
Closes shares connection to a broker- Throws:
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
-
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
- Overrides:
setMessageSelectorin classorg.springframework.jms.listener.AbstractMessageListenerContainer
-
shutdownTaskExecutor
- Throws:
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
-