jakobloekke / jakobloekke-rabbitmq

AMQP-client for Meteor.js
6 stars 1 forks source link

Message subscriber disconnects after error in message handler #5

Open spotla opened 8 years ago

spotla commented 8 years ago

Whenever there is an exception in the code that handles the message, no more new messages will be processed by the queue subscriber.

This is how we reproduced : Post a message to the queue so that the message causes an exception in message handler code. After that, posting any new messages to the same queue will not be received by the subscriber.

We had to fix the issue by wrapping the message handler code in try-catch block as shown below.

q.subscribe({ack: true}, function (message) {
   try{
   }catch(e){
   }
  q.shift();
}

Please let us know if there is any better approach.