Created
July 8, 2016 09:51
-
-
Save lennym/82301d7959ffdd565c4065ef7eba94d1 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
const AWS = require('aws-sdk'); | |
const assert = require('assert'); | |
const kinesis = new AWS.Kinesis({ region: 'eu-west-1' }); | |
function start () { | |
kinesis.describeStream({ StreamName: 'isearch' }, (err, result) => { | |
assert(!err); | |
console.log(result); | |
setInterval(write, 1000); | |
}); | |
} | |
function getRecord () { | |
return { | |
eventType: 'click', | |
uid: 'abc123', | |
tags: [], | |
tileid: 'def456' | |
}; | |
} | |
function write () { | |
const record = getRecord(); | |
kinesis.putRecord({ | |
Data: JSON.stringify(record), | |
PartitionKey: '1', | |
StreamName: 'isearch' | |
}, (err, result) => { | |
if (err) { | |
return console.log('Failed', err); | |
} | |
console.log('Wrote record', result); | |
}); | |
} | |
start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment