You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Jeff Donner <jd...@morphodetection.com> on 2016/09/06 23:13:07 UTC

Any way to do consumer flow control with Proton C++?

Hi,

  Is there any way to do consumer-side flow control from Proton C++? I'm currently using 0.12.1, but I don't see anything different from what I did below even in 0.14.0.

I added the following lines to the example simple_recv.cpp 's on_message() handler,

          std::cout << "received; credits now: "
                  << receiver.credit() << std::endl;

        // Drop it down to -1. 0 doesn't stop anything (-1 also doesn't stop anything)
        while (receiver.credit() > -1) {
          receiver.flow(-1);
          std::cout << "decremented: credits now: "
                    << receiver.credit() << std::endl;
        }

and get:

...
received; credits now: 9
decremented: credits now: 8
decremented: credits now: 7
decremented: credits now: 6
decremented: credits now: 5
decremented: credits now: 4
decremented: credits now: 3
decremented: credits now: 2
decremented: credits now: 1
decremented: credits now: 0
decremented: credits now: -1
{"sequence"=100}
...

which isn't surprising actually since the receiver starts life at 0 credits and receives messages. Anyway, this method doesn't work, is there another way, or is the whole concept of link credit meant to be reserved for the implementation?

Thanks,
Jeff

RE: Any way to do consumer flow control with Proton C++?

Posted by Jeff Donner <jd...@morphodetection.com>.
Whooops, spoke too soon - it looks like this is explicitly supported in 0.14.0. 

Sorry for the noise. 
Jeff
________________________________________
From: Jeff Donner [jdonner@morphodetection.com]
Sent: Tuesday, September 06, 2016 4:13 PM
To: users@qpid.apache.org
Subject: Any way to do consumer flow control with Proton C++?

Hi,

  Is there any way to do consumer-side flow control from Proton C++? I'm currently using 0.12.1, but I don't see anything different from what I did below even in 0.14.0.

I added the following lines to the example simple_recv.cpp 's on_message() handler,

          std::cout << "received; credits now: "
                  << receiver.credit() << std::endl;

        // Drop it down to -1. 0 doesn't stop anything (-1 also doesn't stop anything)
        while (receiver.credit() > -1) {
          receiver.flow(-1);
          std::cout << "decremented: credits now: "
                    << receiver.credit() << std::endl;
        }

and get:

...
received; credits now: 9
decremented: credits now: 8
decremented: credits now: 7
decremented: credits now: 6
decremented: credits now: 5
decremented: credits now: 4
decremented: credits now: 3
decremented: credits now: 2
decremented: credits now: 1
decremented: credits now: 0
decremented: credits now: -1
{"sequence"=100}
...

which isn't surprising actually since the receiver starts life at 0 credits and receives messages. Anyway, this method doesn't work, is there another way, or is the whole concept of link credit meant to be reserved for the implementation?

Thanks,
Jeff

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org