I am writing producer & consumer using rabbitMq node-amqplib library, I am afraid about suddenly to lost connection of server , How could I check whether the connection is alive or not ?
AMQP 0-9-1 offers a heartbeat feature to ensure that the application layer promptly finds out about disrupted connections (and also completely unresponsive peers).
In amqplib you only need to set a heartbeat timeout (non 0) when you call connect([url, [socketOptions]])
and the check will be performed automatically.
More info here:
https://www.squaremobius.net/amqp.node/channel_api.html#heartbeating