From 4d871f17cb37aa95b371ecbeb86f62852b2cc34e Mon Sep 17 00:00:00 2001 From: Tyler Walters Date: Wed, 5 Dec 2018 11:11:59 -0800 Subject: [PATCH] Added a stop_rule_set callback after a message is successfully processed. --- README.md | 5 ++++- index.js | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cebbdd2..878f847 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,10 @@ Otherwise, you can use an existing one. object key prefix. Leave Encrypt Message unchecked and SNS Topic set to [none]. - For the Lambda action: Choose the SesForwarder Lambda function. Leave - Invocation Type set to Event and SNS Topic set to [none]. + Invocation Type set to Event and SNS Topic set to [RequestResponse]. + + - Set the SNS topic for the Stop Action to a topic that will handle any emails + that fail to process. The SNS topic can be subscribed to by an email address. - Finish by naming the rule, ensuring it's enabled and that spam and virus checking are used. diff --git a/index.js b/index.js index ead0495..bb433a2 100644 --- a/index.js +++ b/index.js @@ -312,7 +312,8 @@ exports.handler = function(event, context, callback, overrides) { Promise.series(steps, data) .then(function(data) { data.log({level: "info", message: "Process finished successfully."}); - return data.callback(); + // Success: Let SES know to stop the rule set processing. + callback(null, { disposition: 'stop_rule_set', }); }) .catch(function(err) { data.log({level: "error", message: "Step returned error: " + err.message,