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.Builderbuilder()Creates a builder for configuring and creating anSqsAsyncBatchManager.Buffers and batchesChangeMessageVisibilityRequests using aConsumerto configure the request, sending them as aChangeMessageVisibilityBatchRequest.Buffers and batchesChangeMessageVisibilityRequests, sending them as aChangeMessageVisibilityBatchRequest.default CompletableFuture<DeleteMessageResponse> Buffers and batchesDeleteMessageRequests using aConsumerto configure the request, sending them as aDeleteMessageBatchRequest.default CompletableFuture<DeleteMessageResponse> deleteMessage(DeleteMessageRequest request) Buffers and batchesDeleteMessageRequests, sending them as aDeleteMessageBatchRequest.default CompletableFuture<ReceiveMessageResponse> Buffers and retrieves messages withReceiveMessageRequestusing aConsumerto 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 batchesSendMessageRequests using aConsumerto configure the request, sending them as aSendMessageBatchRequest.default CompletableFuture<SendMessageResponse> sendMessage(SendMessageRequest request) Buffers and batchesSendMessageRequests, 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 batchesSendMessageRequests, 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 batchesSendMessageRequests using aConsumerto 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- AConsumerto configure the SendMessageRequest to be buffered.- Returns:
- CompletableFuture of the corresponding
SendMessageResponse.
-
deleteMessage
Buffers and batchesDeleteMessageRequests, 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 batchesDeleteMessageRequests using aConsumerto 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- AConsumerto configure the DeleteMessageRequest to be buffered.- Returns:
- CompletableFuture of the corresponding
DeleteMessageResponse.
-
changeMessageVisibility
default CompletableFuture<ChangeMessageVisibilityResponse> changeMessageVisibility(ChangeMessageVisibilityRequest request) Buffers and batchesChangeMessageVisibilityRequests, 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 batchesChangeMessageVisibilityRequests using aConsumerto 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- AConsumerto 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 withReceiveMessageRequestusing aConsumerto configure the request, with a maximum of 10 messages per request. Returns an empty message if no messages are available in SQS.- Parameters:
request- AConsumerto configure the ReceiveMessageRequest.- Returns:
- CompletableFuture of the corresponding
ReceiveMessageResponse.
-