[rabbitmq-discuss] Strange behaviour of RabbitMQ or client when network problems occurs

Haster haster2004 at yandex.ru
Thu Sep 12 10:47:47 BST 2013


Hi there!

I have a program that receive messages from RabbitMQ. The program loop is
like below:

init();
basic.consume();

while (1) {
  msg = read_message();
  if (!msg) {
     deinit();
    amqp_delete_connection (...);    // (1)
     sleep(5);
     init();
   }

  int res = process_message();
  if(res) {
   if (amqp_basic_ack(..) < 0) {
     deinit();
    amqp_delete_connection (...);     // (2)
     sleep(5);
     init();
    }
  }
}


In our test we send 100 messages to server after that starts our program and
sometimes make network problems (by firewall REJECT).
And in result we get 11 duplicated messages and only to times we were in
point (2), where
we couldn't send ack.
I can't understand where from 9 duplicated messages come? 

And one more question:
I use prefetch count = 20, for example if we processed 5 messages and after
that network problem occured why the next received message is 25? I thought
that if we close connection and don't send ack messages should stay in
previous order.



--
View this message in context: http://rabbitmq.1065348.n5.nabble.com/Strange-behaviour-of-RabbitMQ-or-client-when-network-problems-occurs-tp29553.html
Sent from the RabbitMQ mailing list archive at Nabble.com.


More information about the rabbitmq-discuss mailing list