Class AmqpClientInboundChannelAdapterSpec
java.lang.Object
org.springframework.integration.dsl.IntegrationComponentSpec<AmqpClientInboundChannelAdapterSpec, AmqpClientMessageProducer>
org.springframework.integration.dsl.MessageProducerSpec<AmqpClientInboundChannelAdapterSpec, AmqpClientMessageProducer>
org.springframework.integration.amqp.dsl.AmqpClientInboundChannelAdapterSpec
- All Implemented Interfaces:
DisposableBean
,FactoryBean<AmqpClientMessageProducer>
,InitializingBean
,Lifecycle
,Phased
,SmartLifecycle
public class AmqpClientInboundChannelAdapterSpec
extends MessageProducerSpec<AmqpClientInboundChannelAdapterSpec, AmqpClientMessageProducer>
Spec for an
AmqpClientMessageProducer
.- Since:
- 7.0
- Author:
- 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
ConstructorsConstructorDescriptionAmqpClientInboundChannelAdapterSpec
(org.springframework.amqp.rabbitmq.client.AmqpConnectionFactory connectionFactory, String... queueNames) Create an instance based on aAmqpConnectionFactory
and queues to consume from. -
Method Summary
Modifier and TypeMethodDescriptionadviceChain
(Advice... advices) SetAdvice
instances to proxy message listener.afterReceivePostProcessors
(MessagePostProcessor... afterReceivePostProcessors) AddMessagePostProcessor
instances to apply on just received messages.autoSettle
(boolean autoSettle) Set tofalse
to propagate an acknowledgement callback into message headers for downstream flow manual settlement.batchReceiveTimeout
(long batchReceiveTimeout) Set a timeout in milliseconds for how long a batch gathering process should go.batchSize
(int batchSize) Set a number of AMQP messages to gather before producing as a single message downstream.consumersPerQueue
(int consumersPerQueue) Each queue runs in its own consumer; set this property to create multiple consumers for each queue.defaultRequeue
(boolean defaultRequeue) Set the default behavior when a message processing has failed.gracefulShutdownPeriod
(Duration gracefulShutdownPeriod) Set a duration for how long to wait for all the consumers to shut down successfully on listener container stop.headerMapper
(AmqpHeaderMapper headerMapper) Set anAmqpHeaderMapper
to map request headers.initialCredits
(int initialCredits) The initial number credits to grant to the AMQP receiver.messageConverter
(@Nullable MessageConverter messageConverter) Set aMessageConverter
to replace the defaultSimpleMessageConverter
.priority
(int priority) The consumer priority.stateListeners
(com.rabbitmq.client.amqp.Resource.StateListener... stateListeners) AddResource.StateListener
instances to the consumer.taskScheduler
(TaskScheduler taskScheduler) Set aTaskScheduler
for monitoring batch releases.Methods inherited from class org.springframework.integration.dsl.MessageProducerSpec
autoStartup, errorChannel, errorChannel, errorMessageStrategy, id, observationConvention, outputChannel, outputChannel, phase, role, sendTimeout, shouldTrack
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
Methods inherited from interface org.springframework.context.SmartLifecycle
isPauseable
-
Constructor Details
-
AmqpClientInboundChannelAdapterSpec
public AmqpClientInboundChannelAdapterSpec(org.springframework.amqp.rabbitmq.client.AmqpConnectionFactory connectionFactory, String... queueNames) Create an instance based on aAmqpConnectionFactory
and queues to consume from.- Parameters:
connectionFactory
- theAmqpConnectionFactory
to connectqueueNames
- queues to consume from
-
-
Method Details
-
initialCredits
The initial number credits to grant to the AMQP receiver. The default is100
.- Parameters:
initialCredits
- number of initial credits- Returns:
- the spec
-
priority
The consumer priority.- Parameters:
priority
- consumer priority- Returns:
- the spec
-
stateListeners
public AmqpClientInboundChannelAdapterSpec stateListeners(com.rabbitmq.client.amqp.Resource.StateListener... stateListeners) AddResource.StateListener
instances to the consumer.- Parameters:
stateListeners
- listeners to add- Returns:
- the spec
-
afterReceivePostProcessors
public AmqpClientInboundChannelAdapterSpec afterReceivePostProcessors(MessagePostProcessor... afterReceivePostProcessors) AddMessagePostProcessor
instances to apply on just received messages.- Parameters:
afterReceivePostProcessors
- listeners to add- Returns:
- the spec
-
batchSize
Set a number of AMQP messages to gather before producing as a single message downstream. Default 1 - no batching.- Parameters:
batchSize
- the batch size to use.- Returns:
- the spec
- See Also:
-
batchReceiveTimeout
Set a timeout in milliseconds for how long a batch gathering process should go. Therefore, the batch is released as a single message whatever first happens: this timeout orbatchSize(int)
. Default 30 seconds.- Parameters:
batchReceiveTimeout
- the timeout for gathering a batch.- Returns:
- the spec
-
taskScheduler
Set aTaskScheduler
for monitoring batch releases.- Parameters:
taskScheduler
- the taskScheduler to use- Returns:
- the spec
-
adviceChain
SetAdvice
instances to proxy message listener.- Parameters:
advices
- the advices to add- Returns:
- the spec
-
autoSettle
Set tofalse
to propagate an acknowledgement callback into message headers for downstream flow manual settlement.- Parameters:
autoSettle
-true
to acknowledge messages automatically.- Returns:
- the spec
-
defaultRequeue
Set the default behavior when a message processing has failed. When true, messages will be requeued, when false, they will be discarded. This option can be overruled by throwingAmqpRejectAndDontRequeueException
orImmediateRequeueAmqpException
from the downstream flow. Default true.- Parameters:
defaultRequeue
- true to requeue by default.- Returns:
- the spec
-
gracefulShutdownPeriod
Set a duration for how long to wait for all the consumers to shut down successfully on listener container stop. Default 30 seconds.- Parameters:
gracefulShutdownPeriod
- the timeout to wait on stop.- Returns:
- the spec
-
consumersPerQueue
Each queue runs in its own consumer; set this property to create multiple consumers for each queue. Can be treated asconcurrency
, but per queue.- Parameters:
consumersPerQueue
- the consumers per queue.- Returns:
- the spec
-
messageConverter
public AmqpClientInboundChannelAdapterSpec messageConverter(@Nullable MessageConverter messageConverter) Set aMessageConverter
to replace the defaultSimpleMessageConverter
. If set to null, an AMQP message is sent as is into a message payload. And a reply message has to return an AMQP message as its payload.- Parameters:
messageConverter
- theMessageConverter
to use or null.- Returns:
- the spec
-
headerMapper
Set anAmqpHeaderMapper
to map request headers.- Parameters:
headerMapper
- theAmqpHeaderMapper
to use.- Returns:
- the spec
-