You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Olivier Delbeke <Ol...@awtce.be> on 2017/11/13 10:31:45 UTC

qpidcpp - identifying messages from on_tracker_accept/on_tracker_reject

 Hi,

How can I identify the accepted/rejected message from within a messaging_handler::on_tracker_accept() or messaging_handler::on_tracker_reject() callback ? I get rejections with "please retry in 10s" from ServiceBus, and I'd like to know which message I have to re-send...
I guess that this info is available in the AMQP packets ('first='?) I can't see any way to add a message reference inside a tracker object.

Thank you,



Re: qpidcpp - identifying messages from on_tracker_accept/on_tracker_reject

Posted by Alan Conway <ac...@redhat.com>.
The tracker is returned when you call sender::send - it applies to the
message that you just sent. Proton does not keep track of the message for
you, because that might be a large amount of memory for applications that
don't need it - however you can keep track of it yourself. tracker is a
subclass of proton::object which supports operator == and < so you can
compare trackers for identity and put them in a std::map, e.g.

    using namespace proton;
    std::map<tracker,message> tracking;
    ...
    tracking[sender.send(msg)] = msg;
    ...
    void on_tracker_accept(tracker& t) {
        auto i = tracking.find(t);
        if (i != tracking.end()) retry_message(i->second)

On Mon, Nov 13, 2017 at 5:31 AM, Olivier Delbeke <Ol...@awtce.be>
wrote:

>  Hi,
>
> How can I identify the accepted/rejected message from within a
> messaging_handler::on_tracker_accept() or messaging_handler::on_tracker_reject()
> callback ? I get rejections with "please retry in 10s" from ServiceBus, and
> I'd like to know which message I have to re-send...
> I guess that this info is available in the AMQP packets ('first='?) I
> can't see any way to add a message reference inside a tracker object.
>
> Thank you,
>
>
>