Interface SqsAsyncBatchManager
- All Superinterfaces:
AutoCloseable
,SdkAutoCloseable
- All Known Implementing Classes:
DefaultSqsAsyncBatchManager
Batch manager for implementing automatic batching with an SQS async client. Create an instance using
builder()
.
This manager buffers client requests and sends them in batches to the service, enhancing efficiency by reducing the number of API requests. Requests are buffered until they reach a specified limit or a timeout occurs.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic SqsAsyncBatchManager.Builder
builder()
Creates a builder for configuring and creating anSqsAsyncBatchManager
.Buffers and batchesChangeMessageVisibilityRequest
s using aConsumer
to configure the request, sending them as aChangeMessageVisibilityBatchRequest
.Buffers and batchesChangeMessageVisibilityRequest
s, sending them as aChangeMessageVisibilityBatchRequest
.default CompletableFuture
<DeleteMessageResponse> Buffers and batchesDeleteMessageRequest
s using aConsumer
to configure the request, sending them as aDeleteMessageBatchRequest
.default CompletableFuture
<DeleteMessageResponse> deleteMessage
(DeleteMessageRequest request) Buffers and batchesDeleteMessageRequest
s, sending them as aDeleteMessageBatchRequest
.default CompletableFuture
<ReceiveMessageResponse> Buffers and retrieves messages withReceiveMessageRequest
using aConsumer
to configure the request, with a maximum of 10 messages per request.default CompletableFuture
<ReceiveMessageResponse> receiveMessage
(ReceiveMessageRequest request) Buffers and retrieves messages withReceiveMessageRequest
, with a maximum of 10 messages per request.default CompletableFuture
<SendMessageResponse> sendMessage
(Consumer<SendMessageRequest.Builder> sendMessageRequest) Buffers and batchesSendMessageRequest
s using aConsumer
to configure the request, sending them as aSendMessageBatchRequest
.default CompletableFuture
<SendMessageResponse> sendMessage
(SendMessageRequest request) Buffers and batchesSendMessageRequest
s, sending them as aSendMessageBatchRequest
.Methods inherited from interface software.amazon.awssdk.utils.SdkAutoCloseable
close
-
Method Details
-
builder
Creates a builder for configuring and creating anSqsAsyncBatchManager
.- Returns:
- A new builder.
-
sendMessage
Buffers and batchesSendMessageRequest
s, sending them as aSendMessageBatchRequest
. Requests are grouped by queue URL and override configuration, and sent when the batch size or timeout is reached.- Parameters:
request
- The SendMessageRequest to be buffered.- Returns:
- CompletableFuture of the corresponding
SendMessageResponse
.
-
sendMessage
default CompletableFuture<SendMessageResponse> sendMessage(Consumer<SendMessageRequest.Builder> sendMessageRequest) Buffers and batchesSendMessageRequest
s using aConsumer
to configure the request, sending them as aSendMessageBatchRequest
. Requests are grouped by queue URL and override configuration, and sent when the batch size or timeout is reached.- Parameters:
sendMessageRequest
- AConsumer
to configure the SendMessageRequest to be buffered.- Returns:
- CompletableFuture of the corresponding
SendMessageResponse
.
-
deleteMessage
Buffers and batchesDeleteMessageRequest
s, sending them as aDeleteMessageBatchRequest
. Requests are grouped by queue URL and override configuration, and sent when the batch size or timeout is reached.- Parameters:
request
- The DeleteMessageRequest to be buffered.- Returns:
- CompletableFuture of the corresponding
DeleteMessageResponse
.
-
deleteMessage
default CompletableFuture<DeleteMessageResponse> deleteMessage(Consumer<DeleteMessageRequest.Builder> request) Buffers and batchesDeleteMessageRequest
s using aConsumer
to configure the request, sending them as aDeleteMessageBatchRequest
. Requests are grouped by queue URL and override configuration, and sent when the batch size or timeout is reached.- Parameters:
request
- AConsumer
to configure the DeleteMessageRequest to be buffered.- Returns:
- CompletableFuture of the corresponding
DeleteMessageResponse
.
-
changeMessageVisibility
default CompletableFuture<ChangeMessageVisibilityResponse> changeMessageVisibility(ChangeMessageVisibilityRequest request) Buffers and batchesChangeMessageVisibilityRequest
s, sending them as aChangeMessageVisibilityBatchRequest
. Requests are grouped by queue URL and override configuration, and sent when the batch size or timeout is reached.- Parameters:
request
- The ChangeMessageVisibilityRequest to be buffered.- Returns:
- CompletableFuture of the corresponding
ChangeMessageVisibilityResponse
.
-
changeMessageVisibility
default CompletableFuture<ChangeMessageVisibilityResponse> changeMessageVisibility(Consumer<ChangeMessageVisibilityRequest.Builder> request) Buffers and batchesChangeMessageVisibilityRequest
s using aConsumer
to configure the request, sending them as aChangeMessageVisibilityBatchRequest
. Requests are grouped by queue URL and override configuration, and sent when the batch size or timeout is reached.- Parameters:
request
- AConsumer
to configure the ChangeMessageVisibilityRequest to be buffered.- Returns:
- CompletableFuture of the corresponding
ChangeMessageVisibilityResponse
.
-
receiveMessage
Buffers and retrieves messages withReceiveMessageRequest
, with a maximum of 10 messages per request. Returns an empty message if no messages are available in SQS.- Parameters:
request
- The ReceiveMessageRequest.- Returns:
- CompletableFuture of the corresponding
ReceiveMessageResponse
.
-
receiveMessage
default CompletableFuture<ReceiveMessageResponse> receiveMessage(Consumer<ReceiveMessageRequest.Builder> request) Buffers and retrieves messages withReceiveMessageRequest
using aConsumer
to configure the request, with a maximum of 10 messages per request. Returns an empty message if no messages are available in SQS.- Parameters:
request
- AConsumer
to configure the ReceiveMessageRequest.- Returns:
- CompletableFuture of the corresponding
ReceiveMessageResponse
.
-