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

Reply via email to