Hi,

Welcome to the list.

The put and send return codes are used for more basic errors, e.g. coding
errors. Tracking the status of outgoing messages has it's own API similar
to the one you've already used in your receiver. Below is a rough example.
I've omitted the return code checking for brevity:

pn_messenger_set_outgoing_window(messenger, N); // track the status of the
last N outgoing messages
pn_messenger_put(messenger, m1);
pn_tracker_t t1 = pn_messenger_outgoing_tracker(messenger); // Grab the
tracker for the last outgoing message (in this case m1)
pn_messenger_put(messenger, m2);
pn_tracker_t t2 = pn_messenger_outgoing_tracker(messenger); // Grab the
tracker for the last outgoing message (in this case m2)
// ...
// ... if you "put" more than N messages without calling send, messenger
won't keep the status for the older trackers
// ...
pn_messenger_send(messenger, -1);

// now check the status for whatever messages I care about:
printf("Status off M1: %d\n", pn_messenger_status(messenger, t1));
// ...

Hopefully this will get you going, but please follow up if you have anymore
questions.

--Rafael


On Fri, Jan 10, 2014 at 2:34 PM, serega <sergejs.melde...@sap.com> wrote:

> Hello. I am evaluating Qpid Proton AMQP Messenger  to communicate with
> SwiftMQ broker. I've had issues with receiving messages, but I used
> suggestion  here <https://issues.apache.org/jira/browse/PROTON-484>   and
> it
> solved the problem.  The use case I am testing is broker is down. Modified
> send.c code:
>
>  int res = pn_messenger_put(messenger, message);
>  printf("Error %d\n", res);
>  check(messenger);
>  res = pn_messenger_send(messenger, -1);
>  printf("Error %d\n", res);
>  check(messenger);
>
>
> The output:
> ______________________________________________
> Error 0
> read: Connection refused
> [0x101009c00:0] ERROR[-2] SASL header mismatch: ''
> send: Broken pipe
> CONNECTION ERROR connection aborted
> Error 0
> ______________________________________________
>
>
> Shouldn't there be a non zero error code as documented in messenger.h ?
> * @return an error code or zero on success
>  * @see error.h
>  */
> PN_EXTERN int pn_messenger_send(pn_messenger_t *messenger, int n);
>
>
> Thanks,
> Sergey.
>
>
>
> --
> View this message in context:
> http://qpid.2158936.n2.nabble.com/pn-messenger-send-return-code-tp7602570.html
> Sent from the Apache Qpid Proton mailing list archive at Nabble.com.
>

Reply via email to