Class DirectRabbitListenerContainerFactory
- java.lang.Object
-
- org.springframework.amqp.rabbit.config.BaseRabbitListenerContainerFactory<C>
-
- org.springframework.amqp.rabbit.config.AbstractRabbitListenerContainerFactory<DirectMessageListenerContainer>
-
- org.springframework.amqp.rabbit.config.DirectRabbitListenerContainerFactory
-
- All Implemented Interfaces:
RabbitListenerContainerFactory<DirectMessageListenerContainer>,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.context.ApplicationEventPublisherAware
public class DirectRabbitListenerContainerFactory extends AbstractRabbitListenerContainerFactory<DirectMessageListenerContainer>
ARabbitListenerContainerFactoryimplementation to build a regularDirectMessageListenerContainer.- Since:
- 2.0
-
-
Field Summary
-
Fields inherited from class org.springframework.amqp.rabbit.config.AbstractRabbitListenerContainerFactory
counter, logger
-
-
Constructor Summary
Constructors Constructor Description DirectRabbitListenerContainerFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DirectMessageListenerContainercreateContainerInstance()Create an empty container instance.protected voidinitializeContainer(DirectMessageListenerContainer instance, RabbitListenerEndpoint endpoint)Further initialize the specified container.voidsetAckTimeout(java.lang.Long ackTimeout)An approximate timeout; whenmessagesPerAckis greater than 1, and this time elapses since the last ack, the pending acks will be sent either when the next message arrives, or a short time later if no additional messages arrive.voidsetConsumersPerQueue(java.lang.Integer consumersPerQueue)Each queue runs in its own consumer; set this property to create multiple consumers for each queue.voidsetMessagesPerAck(java.lang.Integer messagesPerAck)Set the number of messages to receive before acknowledging (success).voidsetMonitorInterval(long monitorInterval)Set how often to run a task to check for failed consumers and idle containers.voidsetTaskScheduler(org.springframework.scheduling.TaskScheduler taskScheduler)Set the task scheduler to use for the task that monitors idle containers and failed consumers.-
Methods inherited from class org.springframework.amqp.rabbit.config.AbstractRabbitListenerContainerFactory
createListenerContainer, getAdviceChain, setAcknowledgeMode, setAdviceChain, setAfterReceivePostProcessors, setApplicationContext, setApplicationEventPublisher, setAutoStartup, setBatchingStrategy, setBatchListener, setChannelTransacted, setConnectionFactory, setConsumerTagStrategy, setContainerCustomizer, setDeBatchingEnabled, setErrorHandler, setFailedDeclarationRetryInterval, setGlobalQos, setIdleEventInterval, setMessageConverter, setMismatchedQueuesFatal, setMissingQueuesFatal, setPhase, setPrefetchCount, setRecoveryBackOff, setRecoveryInterval, setTaskExecutor, setTransactionManager
-
Methods inherited from class org.springframework.amqp.rabbit.config.BaseRabbitListenerContainerFactory
applyCommonOverrides, getDefaultRequeueRejected, setBeforeSendReplyPostProcessors, setDefaultRequeueRejected, setReplyRecoveryCallback, setRetryTemplate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory
createListenerContainer
-
-
-
-
Method Detail
-
setTaskScheduler
public void setTaskScheduler(org.springframework.scheduling.TaskScheduler taskScheduler)
Set the task scheduler to use for the task that monitors idle containers and failed consumers.- Parameters:
taskScheduler- the scheduler.
-
setMonitorInterval
public void setMonitorInterval(long monitorInterval)
Set how often to run a task to check for failed consumers and idle containers.- Parameters:
monitorInterval- the interval; default 10000 but it will be adjusted down to the smallest of this,idleEventInterval/ 2 (if configured) orfailedDeclarationRetryInterval.
-
setConsumersPerQueue
public void setConsumersPerQueue(java.lang.Integer consumersPerQueue)
Each queue runs in its own consumer; set this property to create multiple consumers for each queue. If the container is already running, the number of consumers per queue will be adjusted up or down as necessary.- Parameters:
consumersPerQueue- the consumers per queue.
-
setMessagesPerAck
public void setMessagesPerAck(java.lang.Integer messagesPerAck)
Set the number of messages to receive before acknowledging (success). A failed message will short-circuit this counter.- Parameters:
messagesPerAck- the number of messages.- See Also:
setAckTimeout(Long)
-
setAckTimeout
public void setAckTimeout(java.lang.Long ackTimeout)
An approximate timeout; whenmessagesPerAckis greater than 1, and this time elapses since the last ack, the pending acks will be sent either when the next message arrives, or a short time later if no additional messages arrive. In that case, the actual time depends on themonitorInterval.- Parameters:
ackTimeout- the timeout in milliseconds (default 20000);- See Also:
setMessagesPerAck(Integer)
-
createContainerInstance
protected DirectMessageListenerContainer createContainerInstance()
Description copied from class:AbstractRabbitListenerContainerFactoryCreate an empty container instance.- Specified by:
createContainerInstancein classAbstractRabbitListenerContainerFactory<DirectMessageListenerContainer>- Returns:
- the new container instance.
-
initializeContainer
protected void initializeContainer(DirectMessageListenerContainer instance, RabbitListenerEndpoint endpoint)
Description copied from class:AbstractRabbitListenerContainerFactoryFurther initialize the specified container.Subclasses can inherit from this method to apply extra configuration if necessary.
- Overrides:
initializeContainerin classAbstractRabbitListenerContainerFactory<DirectMessageListenerContainer>- Parameters:
instance- the container instance to configure.endpoint- the endpoint.
-
-