If I understand you correctly, you want to block until MAXCOUNT messages are received before processing the messages. Is that correct?

The "recv" function blocks until *at most* MAXCOUNT messages are received. In practice, it will usually return after the first message is received.

You can achieve the above with something like this:

while (incoming(msgr) < MAXCOUNT)
recv(msgr, MAXCOUNT - incoming(msgr));

-Ted


On 06/07/2013 04:25 PM, atarutin wrote:
Hello all. I am using proton to work with qpid and activemq. Send and receive
examples helped me to understand how I should work with messenger. But the
problem is in receiving messages and I wonder does it only my problem or a
common bug?

The common template of receive code, that was described in example looks
like:
pn_messenger_recv(messenger, MAXCOUNT);
     check(messenger);

     while(pn_messenger_incoming(messenger))
     {
       pn_messenger_get(messenger, message);
       check(messenger);

       ...
     }

While testing this code with activemq and qpid I found out that number of
received messages always equal to 1, regardless of MAXCOUNT value. Whatever
value I provide - I always receive only one message. Even proton example
uses the infinite loop (for (;;)) to get all messages from queue.
Does anybody can explain: is it a bug or my misunderstanding? What should I
do to receive N messages with pn_messenger_recv method over one call?

Thanks in advance.



--
View this message in context: 
http://qpid.2158936.n2.nabble.com/Receiving-messages-with-PROTON-messenger-tp7593934.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.

Reply via email to