Most operations of the AWS Java SDK for SQS require a queue url.
Given a queue name, the queue url can be queried using the GetQueueUrl
operation.
Does the AmazonSQS
client automatically cache the result of this operation, or is it up to the application to cache the queue url to avoid repeated queries?
If we look in the AWS Java SDK code on GitHub, we see that
getQueueUrl()
triggers the usual client preparation hooks (which doesn't appear to include caching), and then immediately jumps toexecuteGetQueueUrl()
which makes the request, also without caching. Interestingly, there does appear to be aURI cachedEndpoint = null;
that doesn't appear to be used anywhere (maybe I'm missing something?).Taking a step back, this makes sense. Auto-caching the response on the SDK could be dangerous for applications using it, so the decision to cache or not cache is left to the application logic where it belongs. So, if you need to cache the responses, it's up to you to decide how long you want to cache it and where/how to store it.