Search code examples
node.jsrabbitmqamqp

Consumer disappears from queue after 30-40 mins


My app just disappears from the list of consumers in RabbitMQ Admin after working just fine for like 30-40 mins. AMQP lib used: node-amqp. Here's the connection:

const con = amqp.createConnection(options,{defaultExchangeName: 'amq.topic', reconnect: true})

The following event handlers are configured too: connect, ready, close, tag.change, error

The worst part is that i don't get any errors or close events, app just disconnects and logs nothing...

It just seems that connection is terminated out of being 'idle' for a while...

Has anyone had something similar? How did you deal with it?


Solution

  • Perhaps this helps someone. To resolve the issue we have to put heartbeat field to options and specify the interval in seconds the connection has to be checked and refreshed. The heartbeat is doesn't have any default values, so if it is not explicitly added, amqp won't use it.