Dear all,
I am writing you because I'm working with the C Qpid Proton library.
In particular, I'm using as reference the "C API reference", available
here:
https://qpid.apache.org/releases/qpid-proton-0.30.0/proton/c/api/files.html

I'm able to successfully send AMQP messages carrying binary data, which is
encapsulated by means of:
message_body=pn_message_body(message);
pn_data_put_binary(message_body,pn_bytes(my_msg_size,(const char *)
&my_msg));

I can see that the messages are successfully sent.

However, I'm having some difficulties in understanding how the receiving
mechanism works.
In the receive.c example (
https://qpid.apache.org/releases/qpid-proton-0.30.0/proton/c/api/receive_8c-example.html)
I noticed that the "decode_message()" function is called, passing a byte
buffer as the only argument, which is in turn calling "pn_inspect()", which
unfortunately is not documented.
What is the purpose of calling this function?

Moreover, I tried receiving the data by using:




















*.....pn_message_t *amqp_message;pn_bytes_t amqp_bytes;char
*amqp_message_buffer;amqp_message=pn_message();rx_size=pn_delivery_pending(d);amqp_message_buffer=malloc(rx_size*sizeof(char));if(!amqp_message_buffer)
{  fprintf(stderr,"Cannot receive message. Memory error.\n");  return
-1;}pn_link_recv(lnk,amqp_message_buffer,rx_size);if(!pn_delivery_partial(d)
&& !pn_delivery_aborted(d)) {
pn_message_decode(amqp_message,amqp_message_buffer,rx_size);
amqp_bytes=pn_data_get_binary(pn_message_body(amqp_message));  .....*

But "amqp_bytes.size" is always 0 and I cannot read any binary data.

Am I doing something wrong?
Is there a way in which I can efficiently receive a message through
"pn_link_recv()", get the corresponding "pn_data_t" message body and then
do "pn_data_get_binary()" to extract exactly the message I sent?

Thank you very much in advance!

Reply via email to