Last active
August 29, 2015 14:13
-
-
Save adamrneary/d0f05a917cd06cd2bc09 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
| // This function is boilerplate for replicating how Amazon Kinesis events are | |
| // passed to Lambda for processing. | |
| // | |
| // payloadString - The String to package | |
| // | |
| // Returns an Object as the data would be passed to Lambda | |
| function packageEvent(payloadString) { | |
| var encodedPayload = new Buffer(payloadString).toString('base64') | |
| return { | |
| "Records": [{ | |
| "kinesis": { | |
| "partitionKey": "partitionKey-3", | |
| "kinesisSchemaVersion": "1.0", | |
| "data": encodedPayload, | |
| "sequenceNumber": "49545115243490985018280067714973144582180062593244200961" | |
| }, | |
| "eventSource": "aws:kinesis", | |
| "eventID": "shardId-000000000000:49545115243490985018280067714973144582180062593244200961", | |
| "invokeIdentityArn": "arn:aws:iam::059493405231:role/testLEBRole", | |
| "eventVersion": "1.0", | |
| "eventName": "aws:kinesis:record", | |
| "eventSourceARN": "arn:aws:kinesis:us-east-1:35667example:stream/examplestream", | |
| "awsRegion": "us-east-1" | |
| }] | |
| }; | |
| } | |
| // This object is boilerplate for the context passed to an Amazon Lambda | |
| // function. Calling done() exits the process Lambda creates. | |
| var context = { | |
| done: function(error, message) { | |
| console.log('done!'); | |
| process.exit(1); | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment