org.axonframework.eventhandling.amqp.spring
Class ExtendedMessageListenerContainer

java.lang.Object
  extended by org.springframework.amqp.rabbit.connection.RabbitAccessor
      extended by org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer
          extended by org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer
              extended by org.axonframework.eventhandling.amqp.spring.ExtendedMessageListenerContainer
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle

public class ExtendedMessageListenerContainer
extends org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer

Specialization of the SimpleMessageListenerContainer that allows consumer to be registered as exclusive on a channel. This allows for active-passive setups, as a second consumer will fallback to retry-mode when a connection is failed. When the first connection is released, a retry will automatically succeed.

Since:
2.0
Author:
Allard Buijze

Nested Class Summary
 
Nested classes/interfaces inherited from class org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer
org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.ContainerDelegate
 
Nested classes/interfaces inherited from class org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer
org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.SharedConnectionNotInitializedException
 
Field Summary
 
Fields inherited from class org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer
DEFAULT_PREFETCH_COUNT, DEFAULT_RECEIVE_TIMEOUT, DEFAULT_RECOVERY_INTERVAL, DEFAULT_SHUTDOWN_TIMEOUT
 
Fields inherited from class org.springframework.amqp.rabbit.connection.RabbitAccessor
logger
 
Constructor Summary
ExtendedMessageListenerContainer()
           
 
Method Summary
 void setConcurrentConsumers(int concurrentConsumers)
          Sets the number of concurrent consumers in this container.
 void setConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory)
           
 void setExclusive(boolean exclusive)
          Sets whether the listener container created by this factory should be exclusive.
 
Methods inherited from class org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer
addAndStartConsumers, addQueueNames, addQueues, createBlockingQueueConsumer, doInitialize, doShutdown, doStart, doStop, getActiveConsumerCount, getRabbitAdmin, handleStartupFailure, initializeConsumers, invokeListener, isChannelLocallyTransacted, removeQueueNames, removeQueues, setAdviceChain, setConsecutiveActiveTrigger, setConsecutiveIdleTrigger, setConsumerArguments, setDefaultRequeueRejected, setMaxConcurrentConsumers, setMessagePropertiesConverter, setMissingQueuesFatal, setPrefetchCount, setQueueNames, setQueues, setRabbitAdmin, setReceiveTimeout, setRecoveryInterval, setShutdownTimeout, setStartConsumerMinInterval, setStopConsumerMinInterval, setTaskExecutor, setTransactionAttribute, setTransactionManager, setTxSize, sharedConnectionEnabled, validateConfiguration
 
Methods inherited from class org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer
afterPropertiesSet, checkMessageListener, destroy, doInvokeListener, doInvokeListener, executeListener, getAcknowledgeMode, getApplicationContext, getBeanName, getMessageListener, getPhase, getQueueNames, getQueueNamesAsSet, getRequiredQueueNames, handleListenerException, initialize, invokeErrorHandler, isActive, isAutoStartup, isExposeListenerChannel, isRunning, setAcknowledgeMode, setApplicationContext, setAutoStartup, setBeanName, setErrorHandler, setExposeListenerChannel, setMessageListener, setPhase, shutdown, start, stop, stop, wrapToListenerExecutionFailedExceptionIfNeeded
 
Methods inherited from class org.springframework.amqp.rabbit.connection.RabbitAccessor
convertRabbitAccessException, createConnection, getChannel, getConnection, getConnectionFactory, getTransactionalResourceHolder, isChannelTransacted, setChannelTransacted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtendedMessageListenerContainer

public ExtendedMessageListenerContainer()
Method Detail

setConnectionFactory

public void setConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory)
Overrides:
setConnectionFactory in class org.springframework.amqp.rabbit.connection.RabbitAccessor

setExclusive

public void setExclusive(boolean exclusive)
Sets whether the listener container created by this factory should be exclusive. That means it will not allow other listeners to connect to the same queue. If a non-exclusive listener is already connected to the queue, this listener is rejected.

Note that setting exclusive mode will force the use of a single concurrent consumer. Therefore, setting the concurrent consumers to a value larger than 1, will disable exclusive mode.

By default, listeners are exclusive.

Overrides:
setExclusive in class org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer
Parameters:
exclusive - Whether the created container should be an exclusive listener

setConcurrentConsumers

public void setConcurrentConsumers(int concurrentConsumers)
Sets the number of concurrent consumers in this container. When larger than 1, this container will not operate in exclusive mode.

Overrides:
setConcurrentConsumers in class org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer
Parameters:
concurrentConsumers - The number of consumers to register on the queue


Copyright © 2010-2016. All Rights Reserved.