Skip to content

Commit

Permalink
WIP: sqs
Browse files Browse the repository at this point in the history
  • Loading branch information
namse committed Oct 19, 2024
1 parent f1652e6 commit 970a616
Show file tree
Hide file tree
Showing 13 changed files with 2,335 additions and 121 deletions.
20 changes: 20 additions & 0 deletions luda-editor/new-server/cdk/lib/AudioTranscodingStack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,23 @@ export class AudioTranscodingStack extends cdk.Stack {
);
}

const deadLetterQueue = new cdk.aws_sqs.Queue(this, "DeadLetterQueue", {
retentionPeriod: cdk.Duration.days(14),
fifo: true,
});

const sqs = new cdk.aws_sqs.Queue(this, "MainSqs", {
fifo: true,
deadLetterQueue: {
queue: deadLetterQueue,
maxReceiveCount: 3,
},
});

if (isLocalstack) {
sqs.grantConsumeMessages(new cdk.aws_iam.AnyPrincipal());
}

const audioTranscodingLambda = new cdk.aws_lambda.Function(
this,
"audioTranscodingLambda",
Expand All @@ -74,6 +91,7 @@ export class AudioTranscodingStack extends cdk.Stack {
? localstackAssetBucketName
: assetBucket.bucketName,
RUST_BACKTRACE: "1",
QUEUE_URL: sqs.queueUrl,
},
architecture: cdk.aws_lambda.Architecture.X86_64,
role: new cdk.aws_iam.Role(this, "audioTranscodingLambdaRole", {
Expand Down Expand Up @@ -104,6 +122,8 @@ export class AudioTranscodingStack extends cdk.Stack {
},
);

sqs.grantSendMessages(audioTranscodingLambda);

if (isLocalstack) {
// cannot use add_event_notification in localstack
// https://github.com/localstack/localstack/issues/9352#issuecomment-1862125662
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ serde = { version = "1.0.210", features = ["derive"] }
serde_json = "1.0.128"
tokio = { version = "1.40.0", features = ["full"] }
tokio-util = { version = "0.7.12", features = ["io"] }
sqs-message = { path = "../../../sqs-message" }
futures = "0.3.30"

[profile.release]
lto = true
Expand Down
Loading

0 comments on commit 970a616

Please sign in to comment.