Skip to content

Commit

Permalink
Add dead letter queue to API stack, to limit retries (#660)
Browse files Browse the repository at this point in the history
* Add dead letter queue to API stack, to limit retries

* fix DLQ name

Change SQS queue DLQ name according to https://qiita.com/tmokmss/items/721a99e9a62499d6d54a. also changed "DLQ" => "Dlq" because not using capitalize-acronym rule.
  • Loading branch information
suzuki-safie authored Jan 9, 2025
1 parent 276aad6 commit 27658bc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cdk/lib/api-publishment-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,15 @@ export class ApiPublishmentStack extends Stack {

const deploymentStage = props.deploymentStage ?? "dev";

const chatQueueDLQ = new sqs.Queue(this, "ChatQueueDlq", {
retentionPeriod: cdk.Duration.days(14),
});
const chatQueue = new sqs.Queue(this, "ChatQueue", {
visibilityTimeout: cdk.Duration.minutes(30),
deadLetterQueue: {
maxReceiveCount: 2, // one retry
queue: chatQueueDLQ,
},
});

const handlerRole = new iam.Role(this, "HandlerRole", {
Expand Down

0 comments on commit 27658bc

Please sign in to comment.