abreits / node-red-contrib-amqp

Node-RED AMQP input and output nodes
16 stars 18 forks source link

Connecting but no messages from topic exchange #26

Open gervais-peter opened 4 years ago

gervais-peter commented 4 years ago

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: #