Description
Type: Feature
Is your feature request related to a problem? Please describe.
We recently migrated from Spring Boot 2.7 to Spring Boot 3.3. One use case we have is that we use a SQS client configured with us-west-2
credentials to send a message to a eu-central-1
queue. With the "old" implementation it was very straightforward, we just had to specify the fully qualified queue URL as the destination (e.g. https://sqs.eu-central-1.amazonaws.com/12345/queueName
). However this doesn't work anymore with the latest Spring Cloud AWS because io.awspring.cloud.sqs.operations.SqsTemplate
always tried to load the queue attributes before sending the message, and that calls fails since it's trying to load it from the wrong region.
Describe the solution you'd like
Looking at the following code from SqsTemplate
:
private CompletableFuture<SendMessageRequest> createSendMessageRequest(String endpointName, Message message) {
return getQueueAttributes(endpointName)
.thenApply(queueAttributes -> doCreateSendMessageRequest(message, queueAttributes));
}
private SendMessageRequest doCreateSendMessageRequest(Message message, QueueAttributes queueAttributes) {
return SendMessageRequest.builder().queueUrl(queueAttributes.getQueueUrl()).messageBody(message.body())
.messageDeduplicationId(message.attributes().get(MessageSystemAttributeName.MESSAGE_DEDUPLICATION_ID))
.messageGroupId(message.attributes().get(MessageSystemAttributeName.MESSAGE_GROUP_ID))
.delaySeconds(getDelaySeconds(message))
.messageAttributes(excludeKnownFields(message.messageAttributes()))
.messageSystemAttributes(mapMessageSystemAttributes(message)).build();
}
It seems like the only reason it's trying to get the queue attributes is to get the queue URL. It would be great if there was a check on endpointName
to see if it was already a fully qualified queue URL, and skip the queue attribute load. This would make it easier to send messages to arbitrary regions.
Describe alternatives you've considered
N/A
Additional context
N/A