[rabbitmq-discuss] Strange behaviour in example_get

fercascue fercascue at gmail.com
Tue Nov 12 09:45:41 GMT 2013


Hi,
I'm experimenting a strange behaviour (or not) using this example. I have
the following code:

int main () {
  try {
	  AMQP amqp("password:admin at localhost:5672");
	  AMQPQueue * qu2 = amqp.createQueue("q2");
	  qu2->Declare();
	  while (1) {
	   qu2->Get(AMQP_NOACK);
 	   AMQPMessage * m=qu2->getMessage();
	   cout << "count: "<<  m->getMessageCount() << endl;
	   cout << "message\n"<< m->getMessage() << "\nmessage key: "<< 
m->getRoutingKey() << endl;
	   cout << "exchange: "<<  m->getExchange() << endl;
	   cout << "Content-type: "<< m->getHeader("Content-type") << endl;
	   cout << "Content-encoding: "<< m->getHeader("Content-encoding") << endl;
  }
} catch (AMQPException e) {
   std::cout << e.getMessage() << std::endl;
}

I explain my behaviour:
1.- When I start this consumer, all the messages in queue are consumed.
2.- Now, when a new message arrives (and the consumer is still running), the
consumer "seems" to consume it, but nothing is printed in the output.  I say
"seems" because the queue doesn't keep the message anymore and "seems" to be
consumed.

I dont know if this is the right behaviour in this case. I tried to use
->Consume instead of Get but I get the same result. 

Any ideas about it?
Best Regards.

- Fercascue





--
View this message in context: http://rabbitmq.1065348.n5.nabble.com/Strange-behaviour-in-example-get-tp31371.html
Sent from the RabbitMQ mailing list archive at Nabble.com.


More information about the rabbitmq-discuss mailing list