Class AmqpClientInboundChannelAdapterSpec

All Implemented Interfaces:
DisposableBean, FactoryBean<AmqpClientMessageProducer>, InitializingBean, Lifecycle, Phased, SmartLifecycle

public class AmqpClientInboundChannelAdapterSpec extends MessageProducerSpec<AmqpClientInboundChannelAdapterSpec, AmqpClientMessageProducer>
Since:
7.0
Author:
Artem Bilan
  • Constructor Details

    • AmqpClientInboundChannelAdapterSpec

      public AmqpClientInboundChannelAdapterSpec(org.springframework.amqp.rabbitmq.client.AmqpConnectionFactory connectionFactory, String... queueNames)
      Create an instance based on a AmqpConnectionFactory and queues to consume from.
      Parameters:
      connectionFactory - the AmqpConnectionFactory to connect
      queueNames - queues to consume from
  • Method Details

    • initialCredits

      public AmqpClientInboundChannelAdapterSpec initialCredits(int initialCredits)
      The initial number credits to grant to the AMQP receiver. The default is 100.
      Parameters:
      initialCredits - number of initial credits
      Returns:
      the spec
    • priority

      public AmqpClientInboundChannelAdapterSpec priority(int priority)
      The consumer priority.
      Parameters:
      priority - consumer priority
      Returns:
      the spec
    • stateListeners

      public AmqpClientInboundChannelAdapterSpec stateListeners(com.rabbitmq.client.amqp.Resource.StateListener... stateListeners)
      Add Resource.StateListener instances to the consumer.
      Parameters:
      stateListeners - listeners to add
      Returns:
      the spec
    • afterReceivePostProcessors

      public AmqpClientInboundChannelAdapterSpec afterReceivePostProcessors(MessagePostProcessor... afterReceivePostProcessors)
      Add MessagePostProcessor instances to apply on just received messages.
      Parameters:
      afterReceivePostProcessors - listeners to add
      Returns:
      the spec
    • batchSize

      public AmqpClientInboundChannelAdapterSpec batchSize(int 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

      public AmqpClientInboundChannelAdapterSpec batchReceiveTimeout(long 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 or batchSize(int). Default 30 seconds.
      Parameters:
      batchReceiveTimeout - the timeout for gathering a batch.
      Returns:
      the spec
    • taskScheduler

      public AmqpClientInboundChannelAdapterSpec taskScheduler(TaskScheduler taskScheduler)
      Set a TaskScheduler for monitoring batch releases.
      Parameters:
      taskScheduler - the taskScheduler to use
      Returns:
      the spec
    • adviceChain

      public AmqpClientInboundChannelAdapterSpec adviceChain(Advice... advices)
      Set Advice instances to proxy message listener.
      Parameters:
      advices - the advices to add
      Returns:
      the spec
    • autoSettle

      public AmqpClientInboundChannelAdapterSpec autoSettle(boolean autoSettle)
      Set to false to propagate an acknowledgement callback into message headers for downstream flow manual settlement.
      Parameters:
      autoSettle - true to acknowledge messages automatically.
      Returns:
      the spec
    • defaultRequeue

      public AmqpClientInboundChannelAdapterSpec defaultRequeue(boolean 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 throwing AmqpRejectAndDontRequeueException or ImmediateRequeueAmqpException from the downstream flow. Default true.
      Parameters:
      defaultRequeue - true to requeue by default.
      Returns:
      the spec
    • gracefulShutdownPeriod

      public AmqpClientInboundChannelAdapterSpec gracefulShutdownPeriod(Duration 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

      public AmqpClientInboundChannelAdapterSpec consumersPerQueue(int consumersPerQueue)
      Each queue runs in its own consumer; set this property to create multiple consumers for each queue. Can be treated as concurrency, but per queue.
      Parameters:
      consumersPerQueue - the consumers per queue.
      Returns:
      the spec
    • messageConverter

      public AmqpClientInboundChannelAdapterSpec messageConverter(@Nullable MessageConverter messageConverter)
      Set a MessageConverter to replace the default SimpleMessageConverter. 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 - the MessageConverter to use or null.
      Returns:
      the spec
    • headerMapper

      public AmqpClientInboundChannelAdapterSpec headerMapper(AmqpHeaderMapper headerMapper)
      Set an AmqpHeaderMapper to map request headers.
      Parameters:
      headerMapper - the AmqpHeaderMapper to use.
      Returns:
      the spec