Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to make SqsClient region agnostic

I see that in docs that for SqsClient, the region must be set in advance, making this client tied to a specific region only. my question is, is it possible to make SqsClient region agnostic, so, requests for different regions can be made using the same client. so, I’m thinking like specifying the region for each operation in queue Url. but when I checked GetQueueUrlRequest, it also doesnt have region field. Is this by design? Is there no way to make SqsClient region agnostic?

Thanks

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

As specified in the AWS SDK Java V2 Dev Guide, when you create a Java V2 Service client object, you specify a region. Regions enable you to access AWS services that physically reside in a specific geographic area.

Regions are never specified using an AWS service opertion Request object. They are always specified using Service Clients. For example,

 SqsClient sqs = SqsClient.builder()
            .region(Region.US_WEST_2)
            .credentialsProvider(ProfileCredentialsProvider.create())
            .build();

That is simply how the Java V2 SDK works. You can read more about this topic in the AWS DEV guide here.

AWS region selection

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading