0

I want to manage queue for my video call feature, so I am trying to first publish the video call data to RabbitMq from the react but not able to see anything in web portal of RabbitMq and there is very less documentation I find for the react to direct RabbitMq.

here is the code which I tried form the react

async function connectRabbitMq() {
    const conn = await amqp.connect("myRabbitMQserverURL");
    const channel = await conn.createChannel();
    await channel.assertQueue("video_call");
    const data = {
      kiosk_id: GlobalConfig.KIOSK_ID,
      hotel_id: GlobalConfig.Hotel.id,
      id: GlobalConfig.KIOSK_PID,
      time_stamp: new Date().toISOString(),
    };
    await channel.sendToQueue(queueName, Buffer.from(JSON.stringify(data)));
    await channel.close();
    await conn.close();
  }

amqp package installed already I also checked the server url it is also perfact.

I am calling this function in my useEffect method. can anyone guide me what I am doing wrong here or I am on wrong way to communicate with rabbitmq. Also if any one can guide me how to consume it in my another react project.

Thanks in advance

hardillb
  • 54,545
  • 11
  • 67
  • 105
Tushar
  • 306
  • 5
  • 14

0 Answers0