0

We have a synchronous REST endpoint that does other processing apart from saving item to DynamoDB database which will be used for later purpose.

The requirement is to not error out if the database save fails due to any type of exception.

How do we handle the case where dynamo db is down in the entire region(rare but possible).Is it the right pattern to publish to SQS and have a seperate process consume and save to DynamoDB by pinging it(ListTables or ping).

Should we fallback to another region or publish to SQS? Is it worth using resilience4j circuit breaker pattern?

rajesh kumar
  • 121
  • 1
  • 13

1 Answers1

0

It is a common pattern to have the API simple enqueue a request to SQS. This has many benefits such as allowing higher throughput, decoupling the producer and consumer and better fault tolerance.

This would be a fine design but your REST API will no longer be synchronous and the caller won't quite know whether the operation was successfully processed so you may need to add another endpoint to get the status of the request.

I am not super familiar with resilence4j circuit breakers but this may not be necessary as the Amazon SDKs already have built in retries if that is the main benefit you are seeking.

JD D
  • 7,398
  • 2
  • 34
  • 53