Retry only the failed SQS records
Try this labAll DVA-C02 practice
- Certification
- DVA-C02
- Format
- Artifact workspace
- Difficulty
- medium
- Estimated time
- 12 min
- Automated checks
- 9
SCENARIO
orders-worker is invoked with batches from a Standard SQS queue. One malformed order currently raises from process_order and fails the whole invocation, so orders already processed successfully become visible and are delivered again. The event-source mapping already has ReportBatchItemFailures enabled; only handler.py is broken.
TASK
Repair handler.py so every record is attempted once, failed records alone appear in batchItemFailures by messageId, and a failure does not stop later records.
- Empty and successful batches must return an empty failure list.
- Preserve the import, handler signature, and incoming event.