Created
May 23, 2016 14:32
Star
You must be signed in to star a gist
This file contains 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
var amqp = require('amqplib'); | |
var http = require('http'); | |
var PUBNUB = require('pubnub'); | |
pubnub = PUBNUB({ | |
publish_key: 'demo', | |
subscribe_key: 'demo' | |
}); | |
amqp.connect('amqp://localhost').then(function(conn) { | |
process.once('SIGINT', function() { conn.close(); }); | |
return conn.createChannel().then(function(ch) { | |
ch.prefetch(100); | |
ch.consume('tasks.send_notification_task', doWork, { noAck: false }); | |
return; | |
function doWork(msg) { | |
var body = msg.content.toString(); | |
var msgObj = JSON.parse(msg.content.toString()); | |
var msg1="test"; | |
console.log(msg); | |
pubnub.publish({ | |
channel: '16182', | |
message: msg1, | |
callback: function(m) { | |
ch.ack(msg); | |
} | |
}); | |
} | |
}); | |
}).then(null, console.warn); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment