Interface AsyncMessagingOperations

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

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

    • sendAsync

      <T> CompletableFuture<SendResult<T>> sendAsync(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:
      a CompletableFuture to be completed with the message's UUID.
    • sendAsync

      <T> CompletableFuture<SendResult<T>> sendAsync(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:
      a CompletableFuture to be completed with the message's UUID.
    • sendAsync

      <T> CompletableFuture<SendResult<T>> sendAsync(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:
      a CompletableFuture to be completed with the message's UUID.
    • sendManyAsync

      <T> CompletableFuture<SendResult.Batch<T>> sendManyAsync(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:
      a CompletableFuture to be completed with the message's UUID.
    • receiveAsync

      CompletableFuture<Optional<Message<?>>> receiveAsync()
      Receive a message from the default queue with default settings.
      Returns:
      a CompletableFuture to be completed with the message, or Optional.empty() if none is returned.
    • receiveAsync

      <T> CompletableFuture<Optional<Message<T>>> receiveAsync(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:
      a CompletableFuture to be completed with the message, or Optional.empty() if none is returned.
    • receiveManyAsync

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

      <T> CompletableFuture<Collection<Message<T>>> receiveManyAsync(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:
      a CompletableFuture to be completed with the messages, or an empty collection if none is returned.