Closed pigLoveRabbit520 closed 3 years ago
my code:
const rabbit = require('foo-foo-mq'); rabbit.handle({ queue: "queue-test", // only handle messages from the queue with this name type: "#", // handle messages with this type name or pattern autoNack: true, // automatically handle exceptions thrown in this handler context: null, // control what `this` is when invoking the handler handler: null // allows you to just pass the handle function as an option property ... because why not? }, (msg) => { console.log('received msg', msg.body); msg.ack(); }); rabbit.configure({ connection: { name: 'default', user: 'test', pass: 'WbsWebZVOzE5A1Bd', host: 'localhost', port: 56720, vhost: '/', replyQueue: false, heartbeat: 10, timeout: 2000, failAfter: 60 * 30, retryLimit: 100000, waitMin: 1000, waitIncrement: 500, waitMax: 3000, }, exchanges: [ { name: 'exchange-test', type: 'direct', autoDelete: false } ], queues: [ { name: 'queue-test', autoDelete: false }, ], bindings: [ { exchange: 'exchange-test', target: 'queue-test', keys: ['test'] } ] }).then( () => { console.log('connected!') } )
there is one message in the queue queue-test, but I can't receive message
queue-test
@salamander-mh can you also provide a screenshot of the message that is in the queue from the rabbit ui
It's my mistake, I didn't add subscribe property for queue.
subscribe
my code:
there is one message in the queue
queue-test
, but I can't receive message