i have 3 replicas of my application and i want each replica should consume two rabbit queues at the same time.how can i implement this?

Viewed 25

i have 3 replicas of my application and i want each replica should consume two rabbit queues at the same time.how can i implement this?? i made 3 replicas of my app locally but every time first one consumed two queues and other did not consume anything. here is my basic code logic

queuesArray.forEach( (queue,index) => {
            console.log("QUEUE",queue,index);
            if(index <= 1){
        rabbitMQChannel.consume(queue, async (msg) => {
          console.log("msg",msg);
            console.log(`successfully consumed`,msg.fields.routingKey,(msg.content.toString()));
            rabbitMQChannel.ack(msg);
          }, { noAck: false });
        }
        });

0 Answers
Related