Package io.awspring.cloud.sqs.operations
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 Summary
Modifier and TypeMethodDescriptionReceive a message from the default queue with default settings.<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.Receive a batch of messages from the default queue with default settings.<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.<T> CompletableFuture<SendResult<T>>
Send the provided message along with its headers to the provided queue.<T> CompletableFuture<SendResult<T>>
Send a message to the provided queue with the provided payload.<T> CompletableFuture<SendResult<T>>
sendAsync
(T payload) Send aMessage
to the default queue with the provided payload.<T> CompletableFuture<SendResult.Batch<T>>
sendManyAsync
(String queue, Collection<Message<T>> messages) Send the provided messages along with their headers to the provided queue.
-
Method Details
-
sendAsync
Send aMessage
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'sUUID
.
-
sendAsync
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'sUUID
.
-
sendAsync
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'sUUID
.
-
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'sUUID
.
-
receiveAsync
CompletableFuture<Optional<Message<?>>> receiveAsync()Receive a message from the default queue with default settings.- Returns:
- a
CompletableFuture
to be completed with the message, orOptional.empty()
if none is returned.
-
receiveAsync
Receive a message from the provided queue and convert the payload to the provided class. If no message is returned after the defaultDuration
, anOptional.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, orOptional.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
Receive a batch of messages from the provided queue and convert the payloads to the provided class. If no message is returned after the defaultDuration
, 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.
-