操作失败:ExchangeBind; 404(NOT-FOUND)带有消息" NOT_FOUND - 没有交换' dead.letters-q.1'

时间:2015-09-25 19:04:41

标签: node.js meteor rabbitmq

如上一个问题所述,我试图将wascally npm包与meteor一起使用,并且它会抛出关于我的交换的设置/配置错误

W20150925-14:22:34.692(-4)? (STDERR) 
W20150925-14:22:34.693(-4)? (STDERR) /Users/rkstar/dev/projects/wacoosta/.meteor/local/isopacks/npm-container/npm/node_modules/wascally/node_modules/when/lib/fatal.js:12
W20150925-14:22:34.693(-4)? (STDERR)            throw e;
W20150925-14:22:34.693(-4)? (STDERR)                  ^
W20150925-14:22:34.694(-4)? (STDERR) Error: Operation failed: ExchangeBind; 404 (NOT-FOUND) with message "NOT_FOUND - no exchange 'dead.letters-q.1' in vhost 'jzywgjfv'"
W20150925-14:22:34.694(-4)? (STDERR)     at reply (/Users/rkstar/dev/projects/wacoosta/.meteor/local/isopacks/npm-container/npm/node_modules/wascally/node_modules/amqplib/lib/channel.js:126:17)
W20150925-14:22:34.694(-4)? (STDERR)     at Channel.C.accept (/Users/rkstar/dev/projects/wacoosta/.meteor/local/isopacks/npm-container/npm/node_modules/wascally/node_modules/amqplib/lib/channel.js:399:7)
W20150925-14:22:34.694(-4)? (STDERR)     at Connection.mainAccept [as accept] (/Users/rkstar/dev/projects/wacoosta/.meteor/local/isopacks/npm-container/npm/node_modules/wascally/node_modules/amqplib/lib/connection.js:62:33)
W20150925-14:22:34.694(-4)? (STDERR)     at Socket.go (/Users/rkstar/dev/projects/wacoosta/.meteor/local/isopacks/npm-container/npm/node_modules/wascally/node_modules/amqplib/lib/connection.js:465:48)
W20150925-14:22:34.694(-4)? (STDERR)     at Socket.emit (events.js:92:17)
W20150925-14:22:34.694(-4)? (STDERR)     at emitReadable_ (_stream_readable.js:427:10)
W20150925-14:22:34.694(-4)? (STDERR)     at emitReadable (_stream_readable.js:423:5)
W20150925-14:22:34.694(-4)? (STDERR)     at readableAddChunk (_stream_readable.js:166:9)
W20150925-14:22:34.695(-4)? (STDERR)     at Socket.Readable.push (_stream_readable.js:128:10)
W20150925-14:22:34.695(-4)? (STDERR)     at TCP.onread (net.js:529:21)

这是我的兔子配置:

{
    connection: {
      user: Meteor.settings.rabbitmq.username,
      pass: Meteor.settings.rabbitmq.password,
      server: Meteor.settings.rabbitmq.server,
      //port: 5672,
      //timeout: 2000
      vhost: Meteor.settings.rabbitmq.vhost
    },
    exchanges:[
      { name: messages.exchanges.dead, type: 'direct' },
      { name: messages.exchanges.tmdb, type: 'direct' },
      { name: messages.exchanges.graph, type: 'direct' }
    ],
    queues:[
      { name: messages.queues.tmdb.read, subscribe: false, durable: true, deadLetter: messages.exchanges.dead },
      { name: messages.queues.tmdb.dead, subscribe: false, durable: true, deadLetter: messages.exchanges.dead },
      { name: messages.queues.graph.read, subscribe: false, durable: true, deadLetter: messages.exchanges.dead },
      { name: messages.queues.graph.write, subscribe: false, durable: true, deadLetter: messages.exchanges.dead }
    ],
    bindings:[{
      exchange: messages.exchanges.tmdb,
      target: messages.queues.tmdb.read,
      keys: [
        messages.keys.tmdb.read.imdb,
        messages.keys.tmdb.read.movies,
        messages.keys.tmdb.read.tv,
        messages.keys.tmdb.read.credits,
        messages.keys.tmdb.read.people
      ]
    },{
      exchange: messages.exchanges.dead,
      target: messages.queues.dead,
      keys: [
        messages.keys.tmdb.dead,
        messages.keys.graph.dead
      ]
    },{
      exchange: messages.exchanges.graph,
      target: messages.queues.graph.read,
      keys: [
        messages.keys.graph.read.any,
        messages.keys.graph.read.movies,
        messages.keys.graph.read.tv,
        messages.keys.graph.read.people,
        messages.keys.graph.read.places
      ]
    },{
      exchange: messages.exchanges.graph,
      target: messages.queues.graph.write,
      keys: [
        messages.keys.graph.write.any,
        messages.keys.graph.write.movies,
        messages.keys.graph.write.tv,
        messages.keys.graph.write.people,
        messages.keys.graph.write.places,
        messages.keys.graph.write.relationships
      ]
    }
    ]
  }

我检查了我的rabbitmq管理员面板,并且我明确地设置了我的死信交换和队列之间的绑定,因此我不确定它在谈论什么或如何解决它

1 个答案:

答案 0 :(得分:0)

尤里卡!经过一些挖掘代码并挖掘到rabbitmq仪表板后,我发现了问题。

  exchanges:[
      { name: messages.exchanges.dead, type: 'direct' },
      { name: messages.exchanges.tmdb, type: 'direct' },
      { name: messages.exchanges.graph, type: 'direct' }
    ],
    queues:[
      { name: messages.queues.tmdb.read, subscribe: false, durable: true, deadLetter: messages.exchanges.dead },
      { name: messages.queues.tmdb.dead, subscribe: false, durable: true, deadLetter: messages.exchanges.dead },
      { name: messages.queues.graph.read, subscribe: false, durable: true, deadLetter: messages.exchanges.dead },
      { name: messages.queues.graph.write, subscribe: false, durable: true, deadLetter: messages.exchanges.dead }
    ]

我正在定义messages.exchanges.dead交换,并将其设置为我的各种队列的deadLetter交换。问题是在dead-letters.q1数组中定义了queues:[]队列 NOT

这意味着虽然dead-letters-ex.1交换已经存在并且可以将消息路由到它,但是没有dead-letters-q.1创建或可用于将这些消息路由到。

ExchangeBind; 404 (NOT-FOUND) with message "NOT_FOUND - no exchange 'dead.letters-q.1'

ExchangeBind错误让我看到了队列与交换的绑定,这导致我把这个兔子洞弄到一个解决方案(双关语)。

现在我的配置看起来像这样:

exchanges:[
  { name: messages.exchanges.dead, type: 'direct' },
  { name: messages.exchanges.tmdb, type: 'direct' },
  { name: messages.exchanges.graph, type: 'direct' }
],
queues:[
  { name: messages.queues.dead, subscribe: false, durable: false },
  { name: messages.queues.tmdb.read, subscribe: false, durable: false, deadLetter: messages.exchanges.dead },
  { name: messages.queues.tmdb.dead, subscribe: false, durable: false, deadLetter: messages.exchanges.dead },
  { name: messages.queues.graph.read, subscribe: false, durable: false, deadLetter: messages.exchanges.dead },
  { name: messages.queues.graph.write, subscribe: false, durable: false, deadLetter: messages.exchanges.dead }
]

我可以继续构建和调试应用程序的其他部分。