Question

I have a problem with channels not closing in amqp-coffee. When using node-amqp I had the same issue, but resolved it with this queue option:

closeChannelOnUnsubscribe: true

Then when my socket.io client disconnected I would unsubscribe his consumerTag from the queue, and the channel would close:

socket.on('disconnect', function () {
    if (consumerTag) {
        my_queue.unsubscribe(consumerTag);
    }
});

Would there be an equivalent in amqp-coffee?

I'm trying all sorts of things like queue.channel.close(), consumer.cancel() and queue.delete(), but none seem to close the channels. I can see that they remain in rabbitmq dashboard with no consumer.

Was it helpful?

Solution

The newest version of amqp-coffee now supports the following:

consumer.close();

One point of confusion for me was where to get the consumer object. It is returned from the connection.consume call:

var consumer = connection.consume(/* ... */);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top