简体   繁体   中英

Does AWS SQS replicate messages across regions?

As SQS is distribute queue, so does it replicate messages in the same region or different region? Looking at architecture at the AWS docs , it shows the message being replicated, but does it replicate in the same region or different regions?

Use case:

I'm setting up queue in region X , but it might be accessed in a region at other end of world. So if there are two workers running one in region X and one in region Y , does both get data from same region X queue or can it be region X and region Y got data from region near to them.

Like X got a message from region X and before the time this info reaches region Y to update queue, then another worker take from replicated region Y queue and reads same message.

PS:- I know SQS in at least once semantics. But I want to know semantics in the above use case.

SQS is a regional service, that is highly available within a single region. There is no cross-region replication capability. You can definitely access the queue from different regions, just initialize the sqs client with the correct destination region.

As a standard practice for AWS services, the data resides within the region that you create the service in.

There are exceptions, but these will require you as the user to perform an action to allow such as copying an AMI, or enabling S3 replication.

If the queue is being consumed in multiple regions, it will always access the regional endpoint of the SQS queue rather than that of the current region.

As SQS is a queueing service, if you have workers distributed across regions the likelihood is that the item is removed from the queue and processed in a single region (although the exact definition would be it is delivered at least once).

If you're trying to have the message consumed in multiple regions, it would be better to consider a fanout based approach whereby each regions workers would consume from their own SQS queue as opposed to sharing one.

For more information take a look at the https://aws.amazon.com/getting-started/hands-on/send-fanout-event-notifications/ documentation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM