Skip to content

Instantly share code, notes, and snippets.

@FGRibreau
Created March 4, 2017 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save FGRibreau/a872b20b6a689cb6b9731117d8bdf27e to your computer and use it in GitHub Desktop.
Save FGRibreau/a872b20b6a689cb6b9731117d8bdf27e to your computer and use it in GitHub Desktop.
PostgresToSNSWorker
// Basic PostgresToSNSWorker worker
const pg = require ('pg');
const pgConString = process.env.POSTGRESQL_CONNECTIONSTRING;
pg.connect(pgConString, function(err, client) {
if(err) {
console.log(err);
}
client.on('notification', function(msg) {
// @todo send message to AWS SNS
console.log(msg);
});
const query = client.query("LISTEN watchers");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment