node-red-contrib-amqp icon indicating copy to clipboard operation
node-red-contrib-amqp copied to clipboard

Connecting but no messages from topic exchange

Open gervais-peter opened this issue 5 years ago • 0 comments

Node is connecting successfully but no messages flowing. I've tested my Rabbit config with the following Node code (sample from RabbitMQ) and this receives messages ok. Code run using wildcard # as topic argument.

var amqp = require('amqplib/callback_api'); var args = process.argv.slice(2);

if (args.length == 0) { console.log("Usage: node robolistener.js [topic]"); process.exit(1); } amqp.connect('amqp://rabbitmqserver', function(err, conn) { conn.createChannel(function(err, ch) { var ex = 'events.X.EVENTS'; ch.assertExchange(ex, 'topic', ); ch.assertQueue('', {exclusive: true}, function(err, q) { console.log(' [*] Waiting for messages. To exit press CTRL+C'); args.forEach(function(key) { ch.bindQueue(q.queue, ex, key); }); ch.consume(q.queue, function(msg) { console.log(" [x] %s:'%s'", msg.fields.routingKey, msg.content.toString()); }, {noAck: true}); }); }); });

Using this configuration in node-red with amqp node connects but does not pass any messages to debug node. Config is as follows:

source: rabbitmqserver:5672 read from: topic exchange events.X.EVENTS topic: #

gervais-peter avatar Sep 09 '19 02:09 gervais-peter