qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robbie Gemmell <robbie.gemm...@gmail.com>
Subject Re: [Proton-c] [C++ bindings][0.14.0] How do I know a message was settled by the receiver?
Date Thu, 17 Nov 2016 15:22:57 GMT
On 16 November 2016 at 18:08, Adel Boutros <Adelboutros@live.com> wrote:
> Hello,
>
>
> I have a simple C++ client which connects to a Qpid Java Broker (6.0.4) and receives
messages.
>
> With the default behavior of the C++ client, how can I know when a delivery has been
settled?
>
> It seems there is no way for me to know that.
>
>
> I have debugged a bit and when the on_message is called, the message becomes in "Acquired"
state on the broker. Later on, somewhere which I haven't found yet, the message is settled
and disappears from the broker. However none of the functions I implemented below is called.
>

To be clear, the message is acquired on the broker before it is ever
sent to the client. When (or if) the on_message fires exactly has no
bearing on that. After the handler returns, the message is then
accepted+settled (unless configured otherwise) and once the broekr
sees that its removed form the queue. This is the same as e.g the JMS
MessageListener case using auto ack.

Most of the methods you show below will only be called when
publishing, to let you know the broker has
accepted/rejected/etc+settled the message you sent (assuming it was
sent unsettled). In this case it is the client is accepting+settling,
and as soon as it does the broker can't update it about that message
again (because the client already considers it settled).

>
> Can you please assist?
>
>
> Console output
>
> -----------------------
>
> on_message
>
>
> Code
>
> -----------------------
>
>
> class MyHandler : public proton::messaging_handler
> {
> public:
>
>    virtual void on_container_start(proton::container &c)
>    {
>       proton::url url("localhost:5672");
>       proton::connection connection = c.connect(url);
>       proton::receiver_options receiverOptions(proton::receiver_options().credit_window(0));
>       connection.open_receiver("queue.name", receiverOptions);
>    }
>
>    virtual void on_receiver_open(proton::receiver& l)
>    {
>       l.add_credit(1);
>    }
>
>    virtual void on_message(proton::delivery &d, proton::message &m)
>    {
>       std::cout << "on_message" << std::endl;
>    }
>    virtual void on_delivery_settle(proton::delivery &d)
>    {
>       std::cout << "on_delivery_settle" << std::endl;
>    }
>    virtual void on_tracker_accept(proton::tracker &d)
>    {
>       std::cout << "on_tracker_accept" << std::endl;
>    }
>
>    virtual void on_tracker_reject(proton::tracker &d)
>    {
>       std::cout << "on_tracker_reject" << std::endl;
>    }
>
>    virtual void on_tracker_release(proton::tracker &d)
>    {
>       std::cout << "on_tracker_release" << std::endl;
>    }
>
>    virtual void on_tracker_settle(proton::tracker &d)
>    {
>       std::cout << "on_tracker_settle" << std::endl;
>    }
> };
>
>
>
> Regards,
>
> Adel

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


Mime
View raw message