qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rabih M <rabih.prom...@gmail.com>
Subject Re: Proton C++ question
Date Fri, 13 May 2016 13:38:33 GMT
Hello again,

Did anyone had time to check my question?

Am I sending to the correct mailing list?

Thanks,
Rabih

On Tue, May 10, 2016 at 12:38 PM, Rabih M <rabih.promail@gmail.com> wrote:

> Hello,
>
>
>
> I have an issue while using proton C++ binding 0.12.0. In my use case, I
> need to get one and only one message from a distant queue.
>
> But I am not able to do it with proton. I read that in the constructor of
> handler I could specify that using prefetch parameter, but it is not
> working.
>
>
>
> Example:
>
> Let’s consider I have a queue on the network that contains 2 messages.
>
> Here is my handler’s implementation:
>
>
>
> class SimpleReceiver : public proton::handler {
>
>   private:
>
>     proton::url url;
>
>
>
>   public:
>
>     SimpleReceiver(const proton::url& u) : *handler(1)*, url(u) {}
>
>
>
>     void on_start(proton::event &e) {
>
>         proton::connection conn = e.container().connect(url);
>
>         conn.open_receiver(url.path());
>
>     }
>
>
>
>     void on_message(proton::event &e) {
>
>         std::cout << e.message().body() << std::endl;
>
>         e.connection().close();
>
>     }
>
> };
>
>
>
> When I run this code the queue is emptied and the client took the 2
> messages from the queue.
>
>
>
> Could you help me understand why I am getting this behavior?
>
>
>
> Thank you,
>
> Rabih
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message