Skip to content

Commit

Permalink
Use a separate dead letter queue for the media download queue
Browse files Browse the repository at this point in the history
  • Loading branch information
philmcmahon committed Oct 9, 2024
1 parent c663acf commit 99fc2db
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 10 deletions.
19 changes: 17 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 45 additions & 7 deletions packages/cdk/lib/__snapshots__/transcription-service.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ exports[`The TranscriptionService stack matches the snapshot 1`] = `
"gu:cdk:constructs": [
"GuAmiParameter",
"GuStringParameter",
"GuStringParameter",
"GuCertificate",
"GuS3Bucket",
"GuS3Bucket",
Expand Down Expand Up @@ -79,6 +80,10 @@ exports[`The TranscriptionService stack matches the snapshot 1`] = `
"Description": "SSM parameter containing the S3 bucket name holding distribution artifacts",
"Type": "AWS::SSM::Parameter::Value<String>",
},
"GiantTranscriptionOutputQueueArn": {
"Default": "/TEST/investigations/GiantTranscriptionOutputQueueArn",
"Type": "AWS::SSM::Parameter::Value<String>",
},
"InvestigationsAlarmTopicArn": {
"Default": "/TEST/investigations/alarmTopicArn",
"Type": "AWS::SSM::Parameter::Value<String>",
Expand Down Expand Up @@ -1021,12 +1026,17 @@ service transcription-service-worker start",
{
"Action": "sqs:SendMessage",
"Effect": "Allow",
"Resource": {
"Fn::GetAtt": [
"transcriptionserviceoutputqueue2A0B1C70",
"Arn",
],
},
"Resource": [
{
"Fn::GetAtt": [
"transcriptionserviceoutputqueue2A0B1C70",
"Arn",
],
},
{
"Ref": "GiantTranscriptionOutputQueueArn",
},
],
},
],
"Version": "2012-10-17",
Expand Down Expand Up @@ -1810,6 +1820,34 @@ service transcription-service-worker start",
},
"Type": "AWS::Lambda::Permission",
},
"transcriptionservicemediadownloaddeadletterqueueE0C3D72F": {
"DeletionPolicy": "Delete",
"Properties": {
"ContentBasedDeduplication": true,
"FifoQueue": true,
"QueueName": "transcription-service-media-download-dead-letter-queue-TEST.fifo",
"Tags": [
{
"Key": "gu:cdk:version",
"Value": "TEST",
},
{
"Key": "gu:repo",
"Value": "guardian/transcription-service",
},
{
"Key": "Stack",
"Value": "investigations",
},
{
"Key": "Stage",
"Value": "TEST",
},
],
},
"Type": "AWS::SQS::Queue",
"UpdateReplacePolicy": "Delete",
},
"transcriptionservicemediadownloadtaskqueue26AAF7A2": {
"DeletionPolicy": "Delete",
"Properties": {
Expand All @@ -1819,7 +1857,7 @@ service transcription-service-worker start",
"RedrivePolicy": {
"deadLetterTargetArn": {
"Fn::GetAtt": [
"transcriptionservicetaskdeadletterqueue8A13A1F1",
"transcriptionservicemediadownloaddeadletterqueueE0C3D72F",
"Arn",
],
},
Expand Down
12 changes: 11 additions & 1 deletion packages/cdk/lib/transcription-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,16 @@ export class TranscriptionService extends GuStack {
// allow worker to write messages to the dead letter queue
transcriptionDeadLetterQueue.grantSendMessages(transcriptionWorkerASG);

const mediaDownloadDeadLetterQueue = new Queue(
this,
`${APP_NAME}-media-download-dead-letter-queue`,
{
fifo: true,
queueName: `${APP_NAME}-media-download-dead-letter-queue-${this.stage}.fifo`,
contentBasedDeduplication: true,
},
);

// SQS queue for media download tasks from API lambda to media-downloader service
const mediaDownloadTaskQueue = new Queue(
this,
Expand All @@ -484,7 +494,7 @@ export class TranscriptionService extends GuStack {
visibilityTimeout: Duration.seconds(30),
contentBasedDeduplication: true,
deadLetterQueue: {
queue: transcriptionDeadLetterQueue,
queue: mediaDownloadDeadLetterQueue,
maxReceiveCount: MAX_RECEIVE_COUNT,
},
},
Expand Down

0 comments on commit 99fc2db

Please sign in to comment.