Class AmqpInvokerServiceExporter

  • All Implemented Interfaces:
    MessageListener, Aware, BeanClassLoaderAware

    public class AmqpInvokerServiceExporter
    extends RemoteInvocationBasedExporter
    implements MessageListener
    will be removed in 3.0.0.
    This message listener exposes a plain java service via AMQP. Such services can be accessed via plain AMQP or via AmqpProxyFactoryBean. To configure this message listener so that it actually receives method calls via AMQP, it needs to be put into a listener container. See MessageListener.

    When receiving a message, a service method is called according to the contained RemoteInvocation. The result of that invocation is returned as a RemoteInvocationResult contained in a message that is sent according to the ReplyToAddress of the received message.

    Please note that this exporter does not use the MessageConverter of the injected AmqpTemplate to convert incoming calls and their results. Instead you have to directly inject the MessageConverter into this class.

    This listener responds to "Request/Reply"-style messages as described here.

    David Bilge, Gary Russell, Artem Bilan
    • Constructor Detail

      • AmqpInvokerServiceExporter

        public AmqpInvokerServiceExporter()
    • Method Detail

      • onMessage

        public void onMessage​(Message message)
        Description copied from interface: MessageListener
        Delivers a single message.
        Specified by:
        onMessage in interface MessageListener
        message - the message.
      • getAmqpTemplate

        public AmqpTemplate getAmqpTemplate()
      • setAmqpTemplate

        public void setAmqpTemplate​(AmqpTemplate amqpTemplate)
        The AMQP template to use for sending the return value.

        Note that the exchange and routing key parameters on this template are ignored for these return messages. Instead of those the respective parameters from the original message's returnAddress are being used.

        Also, the template's MessageConverter is not used for the reply.

        amqpTemplate - The amqp template.
        See Also:
      • getMessageConverter

        public MessageConverter getMessageConverter()
      • setMessageConverter

        public void setMessageConverter​(MessageConverter messageConverter)
        Set the message converter for this remote service. Used to deserialize remote method calls and to serialize their return values.

        The default converter is a SimpleMessageConverter, which is able to handle byte arrays, Strings, and Serializable Objects depending on the message content type header.

        Note that this class never uses the message converter of the underlying AmqpTemplate!

        messageConverter - The message converter.
        See Also: