0

I am using amqplib for connection of rabbitmq. in that i am starting one connection and then i have created channel of that connection. and after establishing connection i do not close the channel and connection as well, in short i open them for time saving purpose to avoid connection establishment time. so my question is that how do i check if channel that i have created is open or not??

The code is written in node-js.

1 Answers1

0

Check it out the rabbitMQ documentation using amqplib: https://www.rabbitmq.com/tutorials/tutorial-one-javascript.html

They using...

  amqp.connect('amqp://localhost', function(error0, connection) {
  if (error0) {
    throw error0;
  }
  connection.createChannel(function(error1, channel) {
    if (error1) {
      throw error1;
    }
    var queue = 'hello';

    channel.assertQueue(queue, {
      durable: false
    });
  });
});

With "assertQueue" ask first if that queue is created

Lveliz
  • 21
  • 4