Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add options for visibility timeout and content based deduplication #177

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/constructs/aws/Queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@ const QUEUE_DEFINITION = {
minimum: 0,
maximum: 300,
},
visibilityTimeout: {
type: "number",
minimum: 0,
maximum: 43200,
},
fifo: { type: "boolean" },
contentBasedDeduplication: { type: "boolean" },
delay: { type: "number" },
encryption: { type: "string" },
encryptionKey: { type: "string" },
Expand Down Expand Up @@ -141,7 +147,8 @@ export class Queue extends AwsConstruct {

// This should be 6 times the lambda function's timeout + MaximumBatchingWindowInSeconds
// See https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html
const visibilityTimeout = functionTimeout * 6 + this.getMaximumBatchingWindow();
const visibilityTimeout =
configuration.visibilityTimeout ?? functionTimeout * 6 + this.getMaximumBatchingWindow();

const maxRetries = configuration.maxRetries ?? 3;

Expand Down Expand Up @@ -199,7 +206,7 @@ export class Queue extends AwsConstruct {
},
fifo: configuration.fifo,
deliveryDelay: delay,
contentBasedDeduplication: configuration.fifo,
contentBasedDeduplication: configuration.contentBasedDeduplication ?? configuration.fifo,
...encryption,
});

Expand Down