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

Visibility timout #82

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
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
13 changes: 0 additions & 13 deletions .github/workflows/greetings.yml

This file was deleted.

12 changes: 0 additions & 12 deletions .github/workflows/label.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/publish.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/stale.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/test.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ jspm_packages
# Serverless directories
**/.serverless
node_modules
/.idea
5 changes: 5 additions & 0 deletions .idea/.gitignore

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

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ functions:
topicArn: !Ref Topic # Required - SNS topic to subscribe to
batchSize: 2 # Optional - default value is 10
maxRetryCount: 2 # Optional - default value is 5
rawMessageDelivery: true # Optional - default value is true
filterPolicy: # Optional - filter messages that are handled
pets:
- dog
Expand Down
22 changes: 13 additions & 9 deletions lib/serverless-sns-sqs-lambda.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,11 @@ Usage
handler: handler.handler
events:
- snsSqs:
name: Event # required
topicArn: !Ref TopicArn # required
maxRetryCount: 2 # optional - default is 5
batchSize: 1 # optional - default is 10
name: Event # required
topicArn: !Ref TopicArn # required
maxRetryCount: 2 # optional - default is 5
batchSize: 1 # optional - default is 10
rawMessageDelivery: false # optional - default is true
filterPolicy:
pet:
- dog
Expand All @@ -164,7 +165,8 @@ Usage
prefix:
config.prefix || `${this.serviceName}-${stage}-${funcNamePascalCase}`,
batchSize: parseIntOr(config.batchSize, 10),
maxRetryCount: parseIntOr(config.maxRetryCount, 5)
maxRetryCount: parseIntOr(config.maxRetryCount, 5),
rawMessageDelivery: config.rawMessageDelivery !== undefined ? config.rawMessageDelivery : true
};
}

Expand Down Expand Up @@ -209,10 +211,10 @@ Usage
* from SNS as they arrive, holding them for processing.
*
* @param {object} template the template which gets mutated
* @param {{name, prefix, maxRetryCount}} config including name of the queue,
* @param {{name, prefix, maxRetryCount, visibilityTimeout}} config including name of the queue,
* the resource prefix and the max retry count for message handler failures.
*/
addEventQueue(template, { name, prefix, maxRetryCount }) {
addEventQueue(template, { name, prefix, maxRetryCount, visibilityTimeout }) {
template.Resources[`${name}Queue`] = {
Type: "AWS::SQS::Queue",
Properties: {
Expand All @@ -222,7 +224,8 @@ Usage
"Fn::GetAtt": [`${name}DeadLetterQueue`, "Arn"]
},
maxReceiveCount: maxRetryCount
}
},
VisibilityTimeout: visibilityTimeout
}
};
}
Expand Down Expand Up @@ -264,13 +267,14 @@ Usage
* @param {{name, topicArn, filterPolicy}} config including name of the queue,
* the arn of the topic and the filter policy for the subscription
*/
addTopicSubscription(template, { name, topicArn, filterPolicy }) {
addTopicSubscription(template, { name, topicArn, filterPolicy, rawMessageDelivery }) {
template.Resources[`Subscribe${name}Topic`] = {
Type: "AWS::SNS::Subscription",
Properties: {
Endpoint: { "Fn::GetAtt": [`${name}Queue`, "Arn"] },
Protocol: "sqs",
TopicArn: topicArn,
RawMessageDelivery: rawMessageDelivery,
...(filterPolicy ? { FilterPolicy: filterPolicy } : {})
}
};
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@agiledigital/serverless-sns-sqs-lambda",
"name": "@venncity/serverless-sns-sqs-lambda",
"version": "0.1.8",
"description": "serverless plugin to make serverless-sns-sqs-lambda events",
"main": "lib/serverless-sns-sqs-lambda.js",
Expand Down