Created
March 10, 2015 16:01
-
-
Save deedubs/6aa1a9a5b3141e85d92b 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
#!/usr/bin/env node | |
var Hoek = require('hoek'); | |
var nsq = require('nsqjs'); | |
var email = require('../lib/email'); | |
var internals = { | |
topicName: 'send-email', | |
channel: 'worker', | |
lookupd: ['localhost:4150'] | |
}; | |
internals.defaults = { | |
}; | |
var reader = new nsq.Reader(internals.topicName, internals.channel, { | |
nsqdTCPAddresses: internals.lookupd | |
}); | |
reader.on('message', function(msg) { | |
var job = JSON.parse(msg.body); | |
var template = job.template; | |
delete job.template; | |
email(template, job, function(err) { | |
if (err) { | |
console.log(err); | |
} | |
msg.finish(); | |
}); | |
}); | |
reader.connect(function (err) { | |
console.log(arguments); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment