Interface MessagingOperations

All Known Subinterfaces:
SqsOperations
All Known Implementing Classes:
AbstractMessagingTemplate, SqsTemplate

public interface MessagingOperations
Synchronous messaging operations. Implementations should have defaults for Nullable fields, and can provide chained methods interfaces to provide a more fluent API.
Since:
3.0
Author:
Tomaz Fernandes
  • Method Details

    • send

      <T> SendResult<T> send(T payload)
      Send a Message to the default queue with the provided payload. The payload will be serialized if necessary.
      Parameters:
      payload - the payload to send.
      Returns:
      The message's UUID.
    • send

      <T> SendResult<T> send(String queue, T payload)
      Send a message to the provided queue with the provided payload. The payload will be serialized if necessary.
      Parameters:
      queue - the queue to send the message to.
      payload - the payload to send.
      Returns:
      The message's UUID.
    • send

      <T> SendResult<T> send(String queue, Message<T> message)
      Send the provided message along with its headers to the provided queue. The payload will be serialized if necessary, and headers will be converted to the specific messaging system metadata types.
      Parameters:
      queue - the queue to send the message to.
      message - the message to be sent.
      Returns:
      The message's UUID.
    • sendMany

      <T> SendResult.Batch<T> sendMany(String queue, Collection<Message<T>> messages)
      Send the provided messages along with their headers to the provided queue. The payloads will be serialized if necessary, and headers will be converted to the specific messaging system metadata types.
      Parameters:
      queue - the queue to send the messages to.
      messages - the messages to be sent.
      Returns:
      The message's UUID.
    • receive

      Optional<Message<?>> receive()
      Receive a message from the default queue with default settings.
      Returns:
      the message or Optional.empty() if none is returned.
    • receive

      <T> Optional<Message<T>> receive(String queue, Class<T> payloadClass)
      Receive a message from the provided queue and convert the payload to the provided class. If no message is returned after the default Duration, an Optional.empty() is returned.
      Parameters:
      queue - the queue from which to receive the messages.
      payloadClass - the class to which the payload should be converted to.
      Returns:
      the message or Optional.empty() if none is returned.
    • receiveMany

      Collection<Message<?>> receiveMany()
      Receive a batch of messages from the default queue with default settings.
      Returns:
      The messages, or an empty collection if none is returned.
    • receiveMany

      <T> Collection<Message<T>> receiveMany(String queue, Class<T> payloadClass)
      Receive a batch of messages from the provided queue and convert the payloads to the provided class. If no message is returned after the default Duration, an empty collection is returned.
      Parameters:
      queue - the queue from which to receive the messages.
      payloadClass - the class to which the payloads should be converted to.
      Returns:
      The messages, or an empty collection if none is returned.