Reputation: 10101
I understand AWS SQS is high reliability, but still there are still chance that network can be disconnected from our server to the AWS datacenter from time to time.
Are there any way tool to prevent this kind of error, e.g. by caching the request locally and resend if network is available again?
Upvotes: 1
Views: 4878
Reputation: 16215
The AWS SDK has built-in retries to handle transient errors - you can configure the retry policy based on your needs. This should handle the most common types of network errors dealing with AWS.
If AWS service you depend on is down for longer than retry policy will handle, then you need to decide how to handle that - you could fallback to other AWS region(s) (very unlikely the service is down in multiple regions), or emit failures to your service callers, or cache locally, drop the requests, or something else entirely.
Handling failure cases is highly variable, and depends on the use case and needs of the system - there's definitely no "one right way". As a note, I've used each of the above failure mode suggestions I made on different systems I've built that depend on AWS.
Upvotes: 1