Skip to content

Instantly share code, notes, and snippets.

@gaybro8777
Forked from FGRibreau/PostgresToSNSWorker.js
Created May 24, 2018 10:43
Show Gist options
  • Save gaybro8777/9dd8f188d15fe55c18436c8c7ba75805 to your computer and use it in GitHub Desktop.
Save gaybro8777/9dd8f188d15fe55c18436c8c7ba75805 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