1

If the RabbitMQ instance if found error then it takes about 120 seconds to timeout before trying to the error

Here is my code used for connecting:

         async function connectAmqp() {
            try {
                // Create amqp connection and is there any error then exit with error.
                cluster = await amqp.connect(`amqp://127.0.0.1:5672`,{
                    timeout:2000
                });
                return cluster;
            } catch (error) {
                throw error;
            }
        }
Armenia
  • 95
  • 1
  • 8

1 Answers1

1

Assuming you are using amqplib.

The second argument takes the timeout value.

It was added in this PR

const amqp = require('amqplib');

const connection = await amqp.connect('amqp://localhost', {
  timeout: 2000,
});
Satya S
  • 228
  • 1
  • 6