Open vilten opened 5 years ago
callback is a function that will get called if the exchange is in confirm mode
You're forced to setup an exchange with the option {confirm: true}
to use the callback:
connection.on('ready', function () {
console.log('Connected.')
connection.exchange('', {confirm: true}, function(exchange) {
exchange.publish('my-queue', '', {}, _ => {
console.log('Executed')
connection.end()
});
});
});
Hello,
when I tried prepare simple publish procedure, callback after publishing message is never executed.
var amqp = require('amqp')
var connection = amqp.createConnection({ host: 'localhost', port: 5672 })
// add this for better debuging connection.on('error', function(e) { console.log("Error from amqp: ", e) })
// Wait for connection to become established. connection.on('ready', function () { console.log('Connected.') connection.publish('my-queue', '', {}, _ => { console.log('Not executed') connection.end() }) })