amqp-coffee
amqp-coffee copied to clipboard
Publish hangs forever after connection loss (reconnect = false)
Hi,
I'm using amqp-coffee with reconnect = false option. Below is an example that reproduces the issue I faced recently. The example is a simple producer that publishes new message every second:
const AMQP = require('amqp-coffee');
const amqp = new AMQP({host: 'localhost', reconnect: false});
setInterval(() => {
amqp.publish('coffee:test', '', 'hello', {}, (err) => {
if (err) return console.log('Error: ' + err);
console.log('Published');
});
}, 1000);
The scenario is following:
- run the example script
- wait until at least one message is published
- shut down message broker server
Expected result: Option 1. For all next publishes the callback is invoked with an error Option 2. The process crashes because of unhandled exception
Actual result:
Next publishes hang forever. Callbacks are never called. As I understand, publish waits until connection is back, but since reconnect is disabled it never happens.
What do you think?