Skip to content
Advertisement

How to getQueueUrl as an array with an array of queueName?

Is there a way to get an array response for val getQueueUrlResponse on SQSClient.getQueueUrl method call with an array of sqsNames? I have many sqsNames and I’d like to batch the request into one request, I’d like to avoid hitting SQSClient multiple times.

val getQueueUrlResponse = sqsClient.getQueueUrl(GetQueueUrlRequest.builder.queueName(sqsName).build)

So if I have 10 elements in Array sqsName, I’d like 10 elements in the getQueueUrlResponse val. I only see one value per call, but I may not be understanding something since I’m new to java/scala. TIA!

getQueueUrl doc

Also: https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/sqs/SqsClient.html#getQueueUrl

Advertisement

Answer

The GetQueueUrl request supports just one SQS queueName at a time. Therefore there’s also no way to get an array back.

As an alternative you could check if it’s feasible to do a single ListQueues request instead. That supports filtering by a common queue name prefix (or returns everything, depending on the size potentially in multiple pages).

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement