Reputation: 1659
I have a bunch of Lambda functions that all take the same value and processes the value in different ways. What I would like to do instead of sending the value to each lambda and making it an extra task in Zapier. I would like to send the value to one lambda and that one function sends the value to all the other Lambda functions for processing. Thus lessening all amount of task Zapier has to execute.
Upvotes: 0
Views: 1206
Reputation: 504
Actually what you can do is to make one of the Lambda functions create a AWS SNS
message; It is going to handle what you post to it and emit a message to the other Lambda function that is listening to AWS SNS
Inside the function of your Lambda 1 (the one that post the message):
var sns = new AWS.SNS({
region: 'us-east-1'
});
exports.handler = function(event, context, callback) {
var params = {
Message: <YOUR_MESSAGE>, /* required */
Subject: 'STRING_VALUE',
TopicArn: <SNS_TOPIC_ARN>
};
sns.publish(params, (err, data) => {
if(err) console.log(err, err.stack);
});
}
and in the other Lambda function that is listening to AWS SNS
:
exports.handler = function(event, context, callback) {
var message = event.Records[0].Sns.Message; /* Here is your message */
}
The best thing of using it, like this, is that you are going to have all your messages in a queue.
Upvotes: 2