Class AmqpClientMessageHandler

All Implemented Interfaces:
org.reactivestreams.Subscriber<Message<?>>, Aware, BeanClassLoaderAware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, Ordered, ComponentSourceAware, ExpressionCapable, Orderable, MessageProducer, HeaderPropagationAware, IntegrationPattern, NamedComponent, IntegrationManagement, TrackableComponent, MessageHandler, reactor.core.CoreSubscriber<Message<?>>

public class AmqpClientMessageHandler extends AbstractReplyProducingMessageHandler
An AbstractReplyProducingMessageHandler implementation for AMQP 1.0 client.

With the AbstractReplyProducingMessageHandler.setRequiresReply(boolean) configured as true, this message handler behaves as a gateway - the RPC over AMQP. In this case, when replyPayloadTypeExpression is provided, the messageConverter must be an instance of SmartMessageConverter.

This handler is async by default.

In async mode, the error is sent to the error channel even if not in a gateway mode.

The exchangeExpression, routingKeyExpression and queueExpression are optional. In this case they have to be supplied by the AsyncAmqpTemplate.

Since:
7.0
Author:
Artem Bilan
  • Constructor Details

  • Method Details

    • setHeaderMapper

      public void setHeaderMapper(AmqpHeaderMapper headerMapper)
    • setMessageConverter

      public void setMessageConverter(MessageConverter messageConverter)
    • setExchange

      public void setExchange(String exchange)
    • setExchangeExpressionString

      public void setExchangeExpressionString(String exchangeExpression)
    • setExchangeExpression

      public void setExchangeExpression(Expression exchangeExpression)
    • setRoutingKey

      public void setRoutingKey(String routingKey)
    • setRoutingKeyExpressionString

      public void setRoutingKeyExpressionString(String routingKeyExpression)
    • setRoutingKeyExpression

      public void setRoutingKeyExpression(Expression routingKeyExpression)
    • setQueue

      public void setQueue(String queue)
    • setQueueExpressionString

      public void setQueueExpressionString(String queueExpression)
    • setQueueExpression

      public void setQueueExpression(Expression queueExpression)
    • setReplyPayloadType

      public void setReplyPayloadType(Class<?> replyPayloadType)
      Set the reply payload type. Used only if AbstractReplyProducingMessageHandler.setRequiresReply(boolean) is true.
      Parameters:
      replyPayloadType - the reply payload type.
    • setReplyPayloadType

      public void setReplyPayloadType(ResolvableType replyPayloadType)
      Set the reply payload type. Used only if AbstractReplyProducingMessageHandler.setRequiresReply(boolean) is true.
      Parameters:
      replyPayloadType - the reply payload type.
    • setReplyPayloadTypeExpressionString

      public void setReplyPayloadTypeExpressionString(String replyPayloadTypeExpression)
      Set a SpEL expression for the reply payload type. Used only if AbstractReplyProducingMessageHandler.setRequiresReply(boolean) is true. Must be evaluated to a Class or ResolvableType.
      Parameters:
      replyPayloadTypeExpression - the expression for a reply payload type.
    • setReplyPayloadTypeExpression

      public void setReplyPayloadTypeExpression(Expression replyPayloadTypeExpression)
      Set a SpEL expression for the reply payload type. Used only if AbstractReplyProducingMessageHandler.setRequiresReply(boolean) is true. Must be evaluated to a Class or ResolvableType.
      Parameters:
      replyPayloadTypeExpression - the expression for a reply payload type.
    • setReturnMessage

      public void setReturnMessage(boolean returnMessage)
      Set to true to return the reply as a whole AMQP message. Used only in the gateway mode.
      Parameters:
      returnMessage - true to return the reply as a whole AMQP message.
    • getComponentType

      public String getComponentType()
      Specified by:
      getComponentType in interface NamedComponent
      Overrides:
      getComponentType in class MessageHandlerSupport
    • doInit

      protected void doInit()
      Overrides:
      doInit in class AbstractReplyProducingMessageHandler
    • handleRequestMessage

      protected @Nullable Object handleRequestMessage(Message<?> requestMessage)
      Description copied from class: AbstractReplyProducingMessageHandler
      Subclasses must implement this method to handle the request Message. The return value may be a Message, a MessageBuilder, or any plain Object. The base class will handle the final creation of a reply Message from any of those starting points. If the return value is null, the Message flow will end here.
      Specified by:
      handleRequestMessage in class AbstractReplyProducingMessageHandler
      Parameters:
      requestMessage - The request message.
      Returns:
      The result of handling the message, or null.