-
-
Save FrankGrimm/ff5f0e763c83f20369c3 to your computer and use it in GitHub Desktop.
This file contains 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
var http_on_error = function http_on_error(context) { | |
return function(e) { | |
console.log("Got error: " + e.message); | |
context.done(e.message); // I need to pass-in the context variable | |
}; | |
}; | |
var http_on_success = function http_on_error(context) { | |
return function(e) { | |
console.log("Got response: " + res.statusCode); | |
context.done(null); // I need to pass-in the context variable | |
}; | |
}; | |
exports.handler = function(event, context) { | |
var success_handler = http_on_success(context); | |
var error_handler = http_on_error(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, success_handler) | |
.on('error', error_handler); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment