Skip to content

Enable SqsTemplate to send more than 10 messages at once #1042

Description

@tomazfernandes

As discussed here, currently SqsTemplate fails if more than 10 messages are provided in a batch with an error from AWS SDK.

We can add support for this use case by partitioning the message list in batches of 10, while also sending the batches in parallel.

This change would likely be around here:

protected <T> CompletableFuture<SendResult.Batch<T>> doSendBatchAsync(String endpointName,
Collection<Message> messages, Collection<org.springframework.messaging.Message<T>> originalMessages) {
logger.debug("Sending messages {} to endpoint {}", messages, endpointName);
return createSendMessageBatchRequest(endpointName, messages).thenCompose(this.sqsAsyncClient::sendMessageBatch)
.thenApply(response -> createSendResultBatch(response, endpointName,
originalMessages.stream().collect(Collectors.toMap(MessageHeaderUtils::getId, msg -> msg))));
}

Metadata

Metadata

Assignees

Labels

component: sqsSQS integration related issuestatus: ideal-for-contributionWe agree it's nice to have but it is not team prioritytype: enhancementSmaller enhancement in existing integration

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions