Skip to content

Instantly share code, notes, and snippets.

@lennym
Created July 8, 2016 09:51
Show Gist options
  • Save lennym/82301d7959ffdd565c4065ef7eba94d1 to your computer and use it in GitHub Desktop.
Save lennym/82301d7959ffdd565c4065ef7eba94d1 to your computer and use it in GitHub Desktop.
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