var AMQPClient = require('amqp10').Client,
Promise = require('bluebird');
var client = new AMQPClient();
client.connect('amqp://localhost')
.then(function() {
return Promise.all([
client.createReceiver('amq.topic'),
client.createSender('amq.topic')
]);
})
.spread(function(receiver, sender) {
receiver.on('errorReceived', function(err) {
receiver.on('message', function(message) {
console.log('Rx message: ', message.body);
});
return sender.send({ key: "Value" });
})
.error(function(err) {
console.log("error: ", err);
});