Interface RabbitMessageOperations

All Superinterfaces:
org.springframework.messaging.core.MessageReceivingOperations<String>, org.springframework.messaging.core.MessageRequestReplyOperations<String>, org.springframework.messaging.core.MessageSendingOperations<String>
All Known Implementing Classes:
RabbitMessagingTemplate

public interface RabbitMessageOperations extends org.springframework.messaging.core.MessageSendingOperations<String>, org.springframework.messaging.core.MessageReceivingOperations<String>, org.springframework.messaging.core.MessageRequestReplyOperations<String>
A specialization of MessageSendingOperations and MessageRequestReplyOperations for AMQP related operations that allow to specify not only the exchange but also the routing key to use.
Since:
1.4
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    convertAndSend(String exchange, String routingKey, Object payload)
    Convert the given Object to serialized form, possibly using a MessageConverter, wrap it as a message and send it to a specific exchange with a specific routing key.
    void
    convertAndSend(String exchange, String routingKey, Object payload, Map<String,Object> headers)
    Convert the given Object to serialized form, possibly using a MessageConverter, wrap it as a message with the given headers and send it to a specific exchange with a specific routing key.
    void
    convertAndSend(String exchange, String routingKey, Object payload, Map<String,Object> headers, org.springframework.messaging.core.MessagePostProcessor postProcessor)
    Convert the given Object to serialized form, possibly using a MessageConverter, wrap it as a message with the given headers, apply the given post processor, and send the resulting message to a specific exchange with a specific routing key.
    void
    convertAndSend(String exchange, String routingKey, Object payload, org.springframework.messaging.core.MessagePostProcessor postProcessor)
    Convert the given Object to serialized form, possibly using a MessageConverter, wrap it as a message, apply the given post processor, and send the resulting message to a specific exchange with a specific routing key.
    <T> T
    convertSendAndReceive(String exchange, String routingKey, Object request, Class<T> targetClass)
    Convert the given request Object to serialized form, possibly using a MessageConverter, send it as a Message to a specific exchange with a specific routing key, receive the reply and convert its body of the specified target class.
    <T> T
    convertSendAndReceive(String exchange, String routingKey, Object request, Class<T> targetClass, org.springframework.messaging.core.MessagePostProcessor requestPostProcessor)
    Convert the given request Object to serialized form, possibly using a MessageConverter, apply the given post processor and send the resulting Message to a specific exchange with a specific routing key, receive the reply and convert its body of the given target class.
    <T> T
    convertSendAndReceive(String exchange, String routingKey, Object request, Map<String,Object> headers, Class<T> targetClass)
    Convert the given request Object to serialized form, possibly using a MessageConverter, send it as a Message with the given headers, to a specific exchange with a specific routing key, receive the reply and convert its body of the specified target class.
    <T> T
    convertSendAndReceive(String exchange, String routingKey, Object request, Map<String,Object> headers, Class<T> targetClass, org.springframework.messaging.core.MessagePostProcessor requestPostProcessor)
    Convert the given request Object to serialized form, possibly using a MessageConverter, wrap it as a message with the given headers, apply the given post processor and send the resulting Message to a specific exchange with a specific routing key,, receive the reply and convert its body of the given target class.
    void
    send(String exchange, String routingKey, org.springframework.messaging.Message<?> message)
    Send a message to a specific exchange with a specific routing key.
    org.springframework.messaging.Message<?>
    sendAndReceive(String exchange, String routingKey, org.springframework.messaging.Message<?> requestMessage)
    Send a request message to a specific exchange with a specific routing key and wait for the reply.

    Methods inherited from interface org.springframework.messaging.core.MessageReceivingOperations

    receive, receive, receiveAndConvert, receiveAndConvert

    Methods inherited from interface org.springframework.messaging.core.MessageRequestReplyOperations

    convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, sendAndReceive, sendAndReceive

    Methods inherited from interface org.springframework.messaging.core.MessageSendingOperations

    convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, send, send
  • Method Details

    • send

      void send(String exchange, String routingKey, org.springframework.messaging.Message<?> message) throws org.springframework.messaging.MessagingException
      Send a message to a specific exchange with a specific routing key.
      Parameters:
      exchange - the name of the exchange
      routingKey - the routing key
      message - the message to send
      Throws:
      org.springframework.messaging.MessagingException - a messaging exception.
    • convertAndSend

      void convertAndSend(String exchange, String routingKey, Object payload) throws org.springframework.messaging.MessagingException
      Convert the given Object to serialized form, possibly using a MessageConverter, wrap it as a message and send it to a specific exchange with a specific routing key.
      Parameters:
      exchange - the name of the exchange
      routingKey - the routing key
      payload - the Object to use as payload
      Throws:
      org.springframework.messaging.MessagingException - a messaging exception.
    • convertAndSend

      void convertAndSend(String exchange, String routingKey, Object payload, Map<String,Object> headers) throws org.springframework.messaging.MessagingException
      Convert the given Object to serialized form, possibly using a MessageConverter, wrap it as a message with the given headers and send it to a specific exchange with a specific routing key.
      Parameters:
      exchange - the name of the exchange
      routingKey - the routing key
      payload - the Object to use as payload
      headers - headers for the message to send
      Throws:
      org.springframework.messaging.MessagingException - a messaging exception.
    • convertAndSend

      void convertAndSend(String exchange, String routingKey, Object payload, org.springframework.messaging.core.MessagePostProcessor postProcessor) throws org.springframework.messaging.MessagingException
      Convert the given Object to serialized form, possibly using a MessageConverter, wrap it as a message, apply the given post processor, and send the resulting message to a specific exchange with a specific routing key.
      Parameters:
      exchange - the name of the exchange
      routingKey - the routing key
      payload - the Object to use as payload
      postProcessor - the post processor to apply to the message
      Throws:
      org.springframework.messaging.MessagingException - a messaging exception.
    • convertAndSend

      void convertAndSend(String exchange, String routingKey, Object payload, Map<String,Object> headers, org.springframework.messaging.core.MessagePostProcessor postProcessor) throws org.springframework.messaging.MessagingException
      Convert the given Object to serialized form, possibly using a MessageConverter, wrap it as a message with the given headers, apply the given post processor, and send the resulting message to a specific exchange with a specific routing key.
      Parameters:
      exchange - the name of the exchange
      routingKey - the routing key
      payload - the Object to use as payload
      headers - headers for the message to send
      postProcessor - the post processor to apply to the message
      Throws:
      org.springframework.messaging.MessagingException - a messaging exception.
    • sendAndReceive

      org.springframework.messaging.Message<?> sendAndReceive(String exchange, String routingKey, org.springframework.messaging.Message<?> requestMessage) throws org.springframework.messaging.MessagingException
      Send a request message to a specific exchange with a specific routing key and wait for the reply.
      Parameters:
      exchange - the name of the exchange
      routingKey - the routing key
      requestMessage - the message to send
      Returns:
      the reply, possibly null if the message could not be received, for example due to a timeout
      Throws:
      org.springframework.messaging.MessagingException - a messaging exception.
    • convertSendAndReceive

      <T> T convertSendAndReceive(String exchange, String routingKey, Object request, Class<T> targetClass) throws org.springframework.messaging.MessagingException
      Convert the given request Object to serialized form, possibly using a MessageConverter, send it as a Message to a specific exchange with a specific routing key, receive the reply and convert its body of the specified target class.
      Type Parameters:
      T - return type
      Parameters:
      exchange - the name of the exchange
      routingKey - the routing key
      request - payload for the request message to send
      targetClass - the target type to convert the payload of the reply to
      Returns:
      the payload of the reply message, possibly null if the message could not be received, for example due to a timeout
      Throws:
      org.springframework.messaging.MessagingException - a messaging exception.
    • convertSendAndReceive

      <T> T convertSendAndReceive(String exchange, String routingKey, Object request, Map<String,Object> headers, Class<T> targetClass) throws org.springframework.messaging.MessagingException
      Convert the given request Object to serialized form, possibly using a MessageConverter, send it as a Message with the given headers, to a specific exchange with a specific routing key, receive the reply and convert its body of the specified target class.
      Type Parameters:
      T - return type
      Parameters:
      exchange - the name of the exchange
      routingKey - the routing key
      request - payload for the request message to send
      headers - headers for the request message to send
      targetClass - the target type to convert the payload of the reply to
      Returns:
      the payload of the reply message, possibly null if the message could not be received, for example due to a timeout
      Throws:
      org.springframework.messaging.MessagingException - a messaging exception.
    • convertSendAndReceive

      <T> T convertSendAndReceive(String exchange, String routingKey, Object request, Class<T> targetClass, org.springframework.messaging.core.MessagePostProcessor requestPostProcessor) throws org.springframework.messaging.MessagingException
      Convert the given request Object to serialized form, possibly using a MessageConverter, apply the given post processor and send the resulting Message to a specific exchange with a specific routing key, receive the reply and convert its body of the given target class.
      Type Parameters:
      T - return type
      Parameters:
      exchange - the name of the exchange
      routingKey - the routing key
      request - payload for the request message to send
      targetClass - the target type to convert the payload of the reply to
      requestPostProcessor - post process to apply to the request message
      Returns:
      the payload of the reply message, possibly null if the message could not be received, for example due to a timeout
      Throws:
      org.springframework.messaging.MessagingException - a messaging exception.
    • convertSendAndReceive

      <T> T convertSendAndReceive(String exchange, String routingKey, Object request, Map<String,Object> headers, Class<T> targetClass, org.springframework.messaging.core.MessagePostProcessor requestPostProcessor) throws org.springframework.messaging.MessagingException
      Convert the given request Object to serialized form, possibly using a MessageConverter, wrap it as a message with the given headers, apply the given post processor and send the resulting Message to a specific exchange with a specific routing key,, receive the reply and convert its body of the given target class.
      Type Parameters:
      T - return type
      Parameters:
      exchange - the name of the exchange
      routingKey - the routing key
      request - payload for the request message to send
      headers - headers for the message to send
      targetClass - the target type to convert the payload of the reply to
      requestPostProcessor - post process to apply to the request message
      Returns:
      the payload of the reply message, possibly null if the message could not be received, for example due to a timeout
      Throws:
      org.springframework.messaging.MessagingException - a messaging exception.