在Meteor中运行的回调中未定义回调参数

Callback parameters undefined in a callback running in Meteor

本文关键字:回调 未定义 参数 运行 Meteor      更新时间:2023-09-26

我有一段代码,我想从Meteor应用程序的RabbitMQ中获取当前消息计数。在Node控制台中运行代码可以正确地给出回调参数,但Meteor中的相同代码只给出第一个参数。

rabbitMQ = AMQP.createConnection({ host: '127.0.0.1' });
rabbitMQ.addListener('ready', function(){
  console.log('Connecting to the channel...');
});
rabbitMQ.addListener('ready', function(){
   rabbitMQ.queue('foo', {durable:true, autoDelete:false}, function (queue, messages, consumers) {
     console.log('Queue ' + queue.name + ' is open with ' + messages + ' messages');
   });
});

节点内打印:

Connecting to the channel...
Queue foo is open with 3 messages

流星打印:

Connecting to the channel...
Queue foo is open with undefined messages

关于为什么在Meteor中运行时只有第一个(队列)参数通过,有什么想法吗?我是Meteor noob,所以可能是光纤问题?

我决定在Mongo中跟踪状态变化比调试这个问题更容易。