Parallel consumption of messages on different queues +rabbitmq+nodejs

It looks like the only library that's there for writing nodejs apps over rabbitmq is the

https://github.com/postwait/node-amqp

I have a producer which is posting messages to multiple queues at a very fast rate, and in the consumer I'm creating subscriptions for each queue.

connection.on('ready', function () {
  for(var i=0;i<queues.length;i++)
  connection.queue(queues[i],{autoDelete:false}, qOnReady);
});
function qOnReady(q){
 // Catch all messages
  logger("Q "+q.name+" is ready");
  q.bind('#');
 // Receive messages
  q.subscribe(subscriber);
}

But when I run the consumer all the messages that are consumed are from a particular queue and till the queue is exhausted , the subscription doesn't start on the other queue.How do I achieve consume messages in parallel.


You might want to use Async Library to achieve parallel execution of your queues.

Though not sure if it fits your needs.

https://github.com/caolan/async#paralleltasks-callback

链接地址: http://www.djcxy.com/p/34168.html

上一篇: 如何使用主动/被动高可用性架构来配置RabbitMQ

下一篇: 并行使用不同队列中的消息+ rabbitmq + nodejs