Last active
August 29, 2015 14:10
-
-
Save alhafoudh/9ce0edd1bac554845bf3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.handler = function(event, context) { | |
for (var i in event.Records) { | |
var record = event.Records[i]; | |
console.log("Processing record"); | |
var data = new Buffer(record.kinesis.data, 'base64').toString(); | |
console.log("Input data: " + data); | |
var http = require('http'); | |
http | |
.get(data, function(res) { | |
console.log("Got response: " + res.statusCode); | |
context.done(null); // I need to pass-in the context variable | |
}) | |
.on('error', function(e) { | |
console.log("Got error: " + e.message); | |
context.done(e.message); // I need to pass-in the context variable | |
}); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment