Created
February 16, 2022 22:48
-
-
Save SalvoCozzubo/e816ae129ba1409c6e3f253afd8b3449 to your computer and use it in GitHub Desktop.
Partial Batch Failure SQS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports.index = async (event) => { | |
const failedIds = event.Records.reduce((acc, item, index) => { | |
// half of records fail | |
if (index % 2 === 0) { | |
acc.push({ itemIdentifier: item.messageId }); | |
} | |
return acc; | |
}, []); | |
return { | |
batchItemFailures: failedIds, | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment