Class AbstractMessageListenerContainerSpec<S extends AbstractMessageListenerContainerSpec<S,C>,C extends AbstractMessageListenerContainer>
java.lang.Object
org.springframework.integration.dsl.IntegrationComponentSpec<S,C>
org.springframework.integration.amqp.dsl.MessageListenerContainerSpec<S,C>
org.springframework.integration.amqp.dsl.AbstractMessageListenerContainerSpec<S,C>
- Type Parameters:
S
- the current spec extension typeC
- the listener container type
- All Implemented Interfaces:
DisposableBean
,FactoryBean<C>
,InitializingBean
,Lifecycle
,Phased
,SmartLifecycle
- Direct Known Subclasses:
DirectMessageListenerContainerSpec
,SimpleMessageListenerContainerSpec
public abstract class AbstractMessageListenerContainerSpec<S extends AbstractMessageListenerContainerSpec<S,C>,C extends AbstractMessageListenerContainer>
extends MessageListenerContainerSpec<S,C>
Base class for container specs for containers that extend
AbstractMessageListenerContainer
.- Since:
- 5.0
- Author:
- Gary Russell, Artem Bilan
-
Field Summary
Fields inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
logger, PARSER, target
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionacknowledgeMode
(AcknowledgeMode acknowledgeMode) addQueueNames
(String... queueName) adviceChain
(Advice... adviceChain) afterReceivePostProcessors
(MessagePostProcessor... afterReceivePostProcessors) SetMessagePostProcessor
s that will be applied after message reception, before invoking theMessageListener
.alwaysRequeueWithTxManagerRollback
(boolean alwaysRequeueWithTxManagerRollback) Set to true to always requeue on transaction rollback with an external TransactionManager.autoDeclare
(boolean autoDeclare) Set to true to automatically declare elements (queues, exchanges, bindings) in the application context during container start().channelTransacted
(boolean transactional) consumerArguments
(Map<String, Object> args) Set consumer arguments.consumerTagStrategy
(ConsumerTagStrategy consumerTagStrategy) Set the implementation ofConsumerTagStrategy
to generate consumer tags.deBatchingEnabled
(boolean deBatchingEnabled) Determine whether the container should de-batch batched messages (true) or call the listener with the batch (false).defaultRequeueRejected
(boolean defaultRequeueRejected) errorHandler
(ErrorHandler errorHandler) exclusive
(boolean exclusive) exclusiveConsumerExceptionLogger
(ConditionalExceptionLogger exclusiveConsumerExceptionLogger) Set aConditionalExceptionLogger
for logging exclusive consumer failures.failedDeclarationRetryInterval
(long failedDeclarationRetryInterval) Set the interval between passive queue declaration attempts in milliseconds.Configure the component identifier.idleEventInterval
(long idleEventInterval) How often to emitListenerContainerIdleEvent
s in milliseconds.lookupKeyQualifier
(String lookupKeyQualifier) Set a qualifier that will prefix the connection factory lookup key; default none.messagePropertiesConverter
(MessagePropertiesConverter messagePropertiesConverter) Set theMessagePropertiesConverter
for this listener container.mismatchedQueuesFatal
(boolean mismatchedQueuesFatal) Prevent the container from starting if any of the queues defined in the context have mismatched arguments (TTL etc.).missingQueuesFatal
(boolean missingQueuesFatal) If all the configured queue(s) are not available on the broker, this setting determines whether the condition is fatal.prefetchCount
(int prefetchCount) recoveryBackOff
(BackOff recoveryBackOff) Specify theBackOff
for interval between recovery attempts.recoveryInterval
(long recoveryInterval) shutdownTimeout
(long shutdownTimeout) statefulRetryFatalWithNullMessageId
(boolean statefulRetryFatalWithNullMessageId) Set whether a message with a null messageId is fatal for the consumer when using stateful retry.taskExecutor
(Executor taskExecutor) Configure anExecutor
used to invoke the message listener.transactionAttribute
(TransactionAttribute transactionAttribute) Set the transaction attribute to use when using an external transaction manager.transactionManager
(PlatformTransactionManager transactionManager) Configure aPlatformTransactionManager
; used to synchronize the rabbit transaction with some other transaction(s).Methods inherited from class org.springframework.integration.amqp.dsl.MessageListenerContainerSpec
queueName
Methods inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
_this, afterPropertiesSet, destroy, doGet, getId, getObject, getObjectType, getPhase, isAutoStartup, isRunning, start, stop, stop
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.beans.factory.FactoryBean
isSingleton
-
Constructor Details
-
AbstractMessageListenerContainerSpec
-
-
Method Details
-
id
Description copied from class:IntegrationComponentSpec
Configure the component identifier. Used as thebeanName
to register the bean in the application context for this component.- Overrides:
id
in classIntegrationComponentSpec<S extends AbstractMessageListenerContainerSpec<S,
C>, C extends AbstractMessageListenerContainer> - Parameters:
id
- the id.- Returns:
- the spec.
-
acknowledgeMode
- Parameters:
acknowledgeMode
- the acknowledgeMode.- Returns:
- the spec.
- See Also:
-
addQueueNames
-
addQueues
-
errorHandler
- Parameters:
errorHandler
- the errorHandler.- Returns:
- the spec.
- See Also:
-
channelTransacted
- Parameters:
transactional
- true for transactional channels.- Returns:
- the spec.
- See Also:
-
adviceChain
-
recoveryInterval
- Parameters:
recoveryInterval
- the recoveryInterval- Returns:
- the spec.
- See Also:
-
exclusive
- Parameters:
exclusive
- true for exclusive.- Returns:
- the spec.
- See Also:
-
shutdownTimeout
- Parameters:
shutdownTimeout
- the shutdownTimeout.- Returns:
- the spec.
- See Also:
-
taskExecutor
-
prefetchCount
- Parameters:
prefetchCount
- the prefetchCount.- Returns:
- the spec.
- See Also:
-
transactionManager
Configure aPlatformTransactionManager
; used to synchronize the rabbit transaction with some other transaction(s).- Parameters:
transactionManager
- the transactionManager.- Returns:
- the spec.
-
defaultRequeueRejected
- Parameters:
defaultRequeueRejected
- the defaultRequeueRejected.- Returns:
- the spec.
- See Also:
-
deBatchingEnabled
Determine whether the container should de-batch batched messages (true) or call the listener with the batch (false). Default: true.- Parameters:
deBatchingEnabled
- the deBatchingEnabled to set.- Returns:
- the spec.
- See Also:
-
afterReceivePostProcessors
SetMessagePostProcessor
s that will be applied after message reception, before invoking theMessageListener
. Often used to decompress data. Processors are invoked in order, depending onPriorityOrder
,Order
and finally unordered.- Parameters:
afterReceivePostProcessors
- the post processor.- Returns:
- the spec.
- See Also:
-
lookupKeyQualifier
-
consumerTagStrategy
Set the implementation ofConsumerTagStrategy
to generate consumer tags. By default, the RabbitMQ server generates consumer tags.- Parameters:
consumerTagStrategy
- the consumerTagStrategy to set.- Returns:
- the spec.
- See Also:
-
consumerArguments
-
idleEventInterval
How often to emitListenerContainerIdleEvent
s in milliseconds.- Parameters:
idleEventInterval
- the interval.- Returns:
- the spec.
- See Also:
-
transactionAttribute
Set the transaction attribute to use when using an external transaction manager.- Parameters:
transactionAttribute
- the transaction attribute to set- Returns:
- the spec.
- See Also:
-
recoveryBackOff
-
messagePropertiesConverter
Set theMessagePropertiesConverter
for this listener container.- Parameters:
messagePropertiesConverter
- the converter for AMQP properties.- Returns:
- the spec.
- See Also:
-
missingQueuesFatal
If all the configured queue(s) are not available on the broker, this setting determines whether the condition is fatal. When true, and the queues are missing during startup, the context refresh() will fail.When false, the condition is not considered fatal and the container will continue to attempt to start the consumers.
- Parameters:
missingQueuesFatal
- the missingQueuesFatal to set.- Returns:
- the spec.
- See Also:
-
mismatchedQueuesFatal
Prevent the container from starting if any of the queues defined in the context have mismatched arguments (TTL etc.). Default false.- Parameters:
mismatchedQueuesFatal
- true to fail initialization when this condition occurs.- Returns:
- the spec.
- See Also:
-
autoDeclare
Set to true to automatically declare elements (queues, exchanges, bindings) in the application context during container start().- Parameters:
autoDeclare
- the boolean flag to indicate a declaration operation.- Returns:
- the spec.
- See Also:
-
failedDeclarationRetryInterval
Set the interval between passive queue declaration attempts in milliseconds.- Parameters:
failedDeclarationRetryInterval
- the interval, default 5000.- Returns:
- the spec.
- See Also:
-
statefulRetryFatalWithNullMessageId
Set whether a message with a null messageId is fatal for the consumer when using stateful retry. When false, instead of stopping the consumer, the message is rejected and not requeued - it will be discarded or routed to the dead letter queue, if so configured. Default true.- Parameters:
statefulRetryFatalWithNullMessageId
- true for fatal.- Returns:
- the spec.
- See Also:
-
exclusiveConsumerExceptionLogger
public S exclusiveConsumerExceptionLogger(ConditionalExceptionLogger exclusiveConsumerExceptionLogger) Set aConditionalExceptionLogger
for logging exclusive consumer failures. The default is to log such failures at WARN level.- Parameters:
exclusiveConsumerExceptionLogger
- the conditional exception logger.- Returns:
- the spec.
- See Also:
-
alwaysRequeueWithTxManagerRollback
Set to true to always requeue on transaction rollback with an external TransactionManager.- Parameters:
alwaysRequeueWithTxManagerRollback
- true to always requeue on rollback.- Returns:
- the spec.
- See Also:
-