Class SimpleRabbitListenerContainerFactory
java.lang.Object
org.springframework.amqp.rabbit.config.BaseRabbitListenerContainerFactory<C>
org.springframework.amqp.rabbit.config.AbstractRabbitListenerContainerFactory<SimpleMessageListenerContainer>
org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory
- All Implemented Interfaces:
RabbitListenerContainerFactory<SimpleMessageListenerContainer>
,Aware
,BeanNameAware
,ApplicationContextAware
,ApplicationEventPublisherAware
public class SimpleRabbitListenerContainerFactory
extends AbstractRabbitListenerContainerFactory<SimpleMessageListenerContainer>
A
RabbitListenerContainerFactory
implementation to build a regular SimpleMessageListenerContainer
.
This should be the default for most users and a good transition paths for those that are used to build such container definition manually.
- Since:
- 1.4
- Author:
- Stephane Nicoll, Gary Russell, Artem Bilan, Dustin Schultz, Jeonggi Kim
-
Field Summary
Fields inherited from class org.springframework.amqp.rabbit.config.AbstractRabbitListenerContainerFactory
counter, logger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SimpleMessageListenerContainer
Create an empty container instance.protected void
initializeContainer
(SimpleMessageListenerContainer instance, RabbitListenerEndpoint endpoint) Further initialize the specified container.void
setBatchReceiveTimeout
(Long batchReceiveTimeout) The number of milliseconds of timeout for gathering batch messages.void
setBatchSize
(Integer batchSize) void
setConcurrentConsumers
(Integer concurrency) void
setConsecutiveActiveTrigger
(Integer minConsecutiveActive) void
setConsecutiveIdleTrigger
(Integer minConsecutiveIdle) void
setConsumerBatchEnabled
(boolean consumerBatchEnabled) Set to true to present a list of messages based on thesetBatchSize(Integer)
, if the listener supports it.void
setEnforceImmediateAckForManual
(Boolean enforceImmediateAckForManual) Set totrue
to enforceChannel.basicAck(long, boolean)
forAcknowledgeMode.MANUAL
whenImmediateAcknowledgeAmqpException
is thrown.void
setMaxConcurrentConsumers
(Integer maxConcurrency) void
setReceiveTimeout
(Long receiveTimeout) void
setStartConsumerMinInterval
(Long minStartInterval) void
setStopConsumerMinInterval
(Long minStopInterval) Methods inherited from class org.springframework.amqp.rabbit.config.AbstractRabbitListenerContainerFactory
createListenerContainer, setAcknowledgeMode, setAfterReceivePostProcessors, setApplicationEventPublisher, setAutoStartup, setBatchingStrategy, setBatchListener, setChannelTransacted, setConnectionFactory, setConsumerTagStrategy, setContainerCustomizer, setDeBatchingEnabled, setErrorHandler, setFailedDeclarationRetryInterval, setForceStop, setGlobalQos, setIdleEventInterval, setMessageAckListener, setMessageConverter, setMismatchedQueuesFatal, setMissingQueuesFatal, setObservationConvention, setPhase, setPrefetchCount, setRecoveryBackOff, setRecoveryInterval, setTaskExecutor, setTransactionManager
Methods inherited from class org.springframework.amqp.rabbit.config.BaseRabbitListenerContainerFactory
applyCommonOverrides, getAdviceChain, getApplicationContext, getBeanName, getDefaultRequeueRejected, getMicrometerEnabled, getObservationEnabled, setAdviceChain, setApplicationContext, setBeanName, setBeforeSendReplyPostProcessors, setDefaultRequeueRejected, setMicrometerEnabled, setObservationEnabled, setReplyPostProcessorProvider, 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.context.ApplicationContextAware
setApplicationContext
Methods inherited from interface org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory
createListenerContainer
-
Constructor Details
-
SimpleRabbitListenerContainerFactory
public SimpleRabbitListenerContainerFactory()
-
-
Method Details
-
setBatchSize
- Parameters:
batchSize
- the batch size.- Since:
- 2.2
- See Also:
-
setConcurrentConsumers
- Parameters:
concurrency
- the minimum number of consumers to create.- See Also:
-
setMaxConcurrentConsumers
- Parameters:
maxConcurrency
- the maximum number of consumers.- See Also:
-
setStartConsumerMinInterval
- Parameters:
minStartInterval
- The minimum interval between new consumer starts.- See Also:
-
setStopConsumerMinInterval
- Parameters:
minStopInterval
- The minimum interval between consumer stops.- See Also:
-
setConsecutiveActiveTrigger
- Parameters:
minConsecutiveActive
- The number of consecutive receives to trigger a new consumer.- See Also:
-
setConsecutiveIdleTrigger
- Parameters:
minConsecutiveIdle
- The number of consecutive timeouts to trigger stopping a consumer.- See Also:
-
setReceiveTimeout
- Parameters:
receiveTimeout
- the timeout.- See Also:
-
setBatchReceiveTimeout
The number of milliseconds of timeout for gathering batch messages. It limits the time to wait to fill batchSize. Default is 0 (no timeout).- Parameters:
batchReceiveTimeout
- the timeout for gathering batch messages.- Since:
- 3.1.2
- See Also:
-
setConsumerBatchEnabled
public void setConsumerBatchEnabled(boolean consumerBatchEnabled) Set to true to present a list of messages based on thesetBatchSize(Integer)
, if the listener supports it. Starting with version 3.0, setting this to true will alsoAbstractRabbitListenerContainerFactory.setBatchListener(boolean)
to true.- Parameters:
consumerBatchEnabled
- true to create message batches in the container.- Since:
- 2.2
- See Also:
-
setEnforceImmediateAckForManual
Set totrue
to enforceChannel.basicAck(long, boolean)
forAcknowledgeMode.MANUAL
whenImmediateAcknowledgeAmqpException
is thrown. This might be a tentative solution to not break behavior for current minor version.- Parameters:
enforceImmediateAckForManual
- the flag to ack message for MANUAL mode on ImmediateAcknowledgeAmqpException- Since:
- 3.1.2
-
createContainerInstance
Description copied from class:AbstractRabbitListenerContainerFactory
Create an empty container instance.- Specified by:
createContainerInstance
in classAbstractRabbitListenerContainerFactory<SimpleMessageListenerContainer>
- Returns:
- the new container instance.
-
initializeContainer
protected void initializeContainer(SimpleMessageListenerContainer instance, RabbitListenerEndpoint endpoint) Description copied from class:AbstractRabbitListenerContainerFactory
Further initialize the specified container.Subclasses can inherit from this method to apply extra configuration if necessary.
- Overrides:
initializeContainer
in classAbstractRabbitListenerContainerFactory<SimpleMessageListenerContainer>
- Parameters:
instance
- the container instance to configure.endpoint
- the endpoint.
-