Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connection.completeConfiguration() doesn't reject the Promise if the connection string passed is wrong. #22

Open
marcopogo81 opened this issue May 18, 2017 · 3 comments

Comments

@marcopogo81
Copy link

connection.completeConfiguration() doesn't reject the Promise if the connection string passed is wrong.

//wrong connection string
let connString:string='amqp://donald:duck@ducktales:'+cfg.Port;
let connection = new Amqp.Connection(connString);

let queue = connection.declareQueue("QUEUE_1", { durable: false, prefetch:1, });
queue.activateConsumer(this.onMessage, { noAck: false });

connection.completeConfiguration().then(() => {
       $log.debug('[RabbitConsumer] END - Connection completed');
}).catch((err)=>{
        //never log this
       $log.error('[RabbitConsumer] ERROR: ['+err+']');
});
private onMessage=(message: Amqp.Message)=>{
...
}
@fan-tom
Copy link
Contributor

fan-tom commented Apr 23, 2020

Affects me too, very annoying

@justinrush
Copy link

Any thoughts for fixing this or working around it? How can I validate a connection or set some sort of timeout on trying to validate the connection with completeConfiguration?

@michaelgriffithus
Copy link

I am also experiencing this, if the connection string is wrong there is no error thrown.

  const connection = new Amqp.Connection(process.env.AMQP_HOST);
  const queue = connection.declareQueue(myQueue, { durable: true });
  if (queue) {
    logger.debug(`Connected to MQ queue ${myQueue}`);
    const msg = new Amqp.Message(queryStr);
    queue.send(msg);
  } else {
    logger.error(new Error(`Unable to connect to queue ${myQueue}`));
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants