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

匿名 (未验证) 提交于 2019-12-03 01:26:01

问题:

as referenced in a previous question, i'm trying to use the wascally npm package with meteor and it's throwing what seems to be a setup/config error about my exchanges

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) 

here is my rabbit config:

{     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       ]     }     ]   } 

i checked in my rabbitmq admin panel and i've explicitly set up a binding between my dead letters exchange and queue, so i'm not sure what it's talking about or how to resolve it.

回答1:

eureka! after some digging through the code and digging into the rabbitmq dashboard, i found the problem.

  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 }     ] 

i was defining the messages.exchanges.dead exchange, and setting that as the deadLetter exchange for my various queues. the problem was that the dead-letters.q1 queue was NOT being defined in the queues:[] array.

this meant that while the dead-letters-ex.1 exchange existed and could have messages routed to it, there was no dead-letters-q.1 created or available to route those messages to.

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

the ExchangeBind error was what got me looking at the bindings of queues to exchanges which led me down this rabbit hole to a solution (pun intended).

now my config looks like this:

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 } ] 

and i can continue building and debugging other parts of the application.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!