Class AmqpClientInboundGatewaySpec

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

public class AmqpClientInboundGatewaySpec extends MessagingGatewaySpec<AmqpClientInboundGatewaySpec, AmqpClientInboundGateway>
Since:
7.0
Author:
Artem Bilan
  • Constructor Details

    • AmqpClientInboundGatewaySpec

      public AmqpClientInboundGatewaySpec(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 AmqpClientInboundGatewaySpec 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 AmqpClientInboundGatewaySpec priority(int priority)
      The consumer priority.
      Parameters:
      priority - consumer priority
      Returns:
      the spec
    • stateListeners

      public AmqpClientInboundGatewaySpec 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 AmqpClientInboundGatewaySpec afterReceivePostProcessors(MessagePostProcessor... afterReceivePostProcessors)
      Add MessagePostProcessor instances to apply on just received messages.
      Parameters:
      afterReceivePostProcessors - listeners to add
      Returns:
      the spec
    • adviceChain

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

      public AmqpClientInboundGatewaySpec 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 AmqpClientInboundGatewaySpec 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 AmqpClientInboundGatewaySpec 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 AmqpClientInboundGatewaySpec 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 AmqpClientInboundGatewaySpec 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 AmqpClientInboundGatewaySpec headerMapper(AmqpHeaderMapper headerMapper)
      Set an AmqpHeaderMapper to map request and reply headers.
      Parameters:
      headerMapper - the AmqpHeaderMapper to use.
      Returns:
      the spec
    • replyPostProcessor

      public AmqpClientInboundGatewaySpec replyPostProcessor(ReplyPostProcessor replyPostProcessor)
      Set an ReplyPostProcessor to modify reply AMQP message before producing.
      Parameters:
      replyPostProcessor - the ReplyPostProcessor to use.
      Returns:
      the spec
    • replyExchange

      public AmqpClientInboundGatewaySpec replyExchange(String exchange)
      Set an exchange for publishing reply. Mutually exclusive with replyQueue(String). If neither is set, the replyTo property from the request message is used to determine where to produce a reply.
      Parameters:
      exchange - the exchange to send a reply.
      Returns:
      the spec
    • replyRoutingKey

      public AmqpClientInboundGatewaySpec replyRoutingKey(String routingKey)
      Set a routing key for publishing reply. Used only together with replyExchange(String). If neither is set, the replyTo property from the request message is used to determine where to produce a reply.
      Parameters:
      routingKey - the routing key to send a reply.
      Returns:
      the spec
    • replyQueue

      public AmqpClientInboundGatewaySpec replyQueue(String queue)
      Set a queue for publishing reply. Mutually exclusive with replyExchange(String). If neither is set, the replyTo property from the request message is used to determine where to produce a reply.
      Parameters:
      queue - the queue to send a reply.
      Returns:
      the spec