On 30/03/17 13:25, Gordon Sim wrote:
Is there a bug or feature request for Data sections in RabbitMQ? I couldn't find their bug tracker. I've opened a bug report[1] against the Debian package.
In my case the strings are coming from the command line, so now I change the string to unicode like this:
_s = unicode(s, "utf-8")
and then:
a) I can send without inferred=True and the broker accepts the message
b) in the C++ receiver, the message is now received as a string and I can use:
_json = proton::getstd::string(m.body());
Could this be made more obvious in the examples perhaps, e.g. helloworld.py could change from:
event.sender.send(Message(body="Hello World!"))
to
event.sender.send(Message(body=unicode("Hello World!", "utf-8")))
I realize that is a bit verbose and redundant when you already have unicode_literals, but for people who are cutting and pasting from the examples they will get up and running more quickly.
The kazoo module source code is on Github[2], I had a quick look at it and it isn't immediately obvious to me which AMQP version it uses or which data type it is using for the message body. Is anybody more familiar with AMQP C client programming able to spot any keywords in that code that suggest what it is doing? I've added the kazoo module developers on CC in case they can comment on this, it would be useful to answer this in the module's README file.
Regards,
Daniel
1. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=859399 2. https://github.com/sipwise/kamailio/tree/master/modules/kazoo
kazoo module uses whatever rabbitmq supports (AMQP 0-9-1)
https://www.rabbitmq.com/protocol.html
content type is
props._flags = AMQP_BASIC_CONTENT_TYPE_FLAG; props.content_type = amqp_cstring_bytes("application/json");
this is enforced in publishing and consuming
and the proper url for the kazoo module would be https://github.com/kamailio/kamailio/tree/master/src/modules/kazoo
kazoo module is built with https://github.com/alanxz/rabbitmq-c
if you're using python, you may want to try https://pika.readthedocs.io/en/0.10.0/ instead
hope this helps
Cheers ________________________________ From: Daniel Pocock daniel@pocock.pro Sent: Monday, April 3, 2017 10:18:39 AM To: users@qpid.apache.org Cc: Engineering; Luis Azedo; sr-dev@lists.sip-router.org Subject: Re: qpid-proton and rabbitmq (and Kamailio kazoo module)
On 30/03/17 13:25, Gordon Sim wrote:
Is there a bug or feature request for Data sections in RabbitMQ? I couldn't find their bug tracker. I've opened a bug report[1] against the Debian package.
In my case the strings are coming from the command line, so now I change the string to unicode like this:
_s = unicode(s, "utf-8")
and then:
a) I can send without inferred=True and the broker accepts the message
b) in the C++ receiver, the message is now received as a string and I can use:
_json = proton::getstd::string(m.body());
Could this be made more obvious in the examples perhaps, e.g. helloworld.py could change from:
event.sender.send(Message(body="Hello World!"))
to
event.sender.send(Message(body=unicode("Hello World!", "utf-8")))
I realize that is a bit verbose and redundant when you already have unicode_literals, but for people who are cutting and pasting from the examples they will get up and running more quickly.
The kazoo module source code is on Github[2], I had a quick look at it and it isn't immediately obvious to me which AMQP version it uses or which data type it is using for the message body. Is anybody more familiar with AMQP C client programming able to spot any keywords in that code that suggest what it is doing? I've added the kazoo module developers on CC in case they can comment on this, it would be useful to answer this in the module's README file.
Regards,
Daniel
1. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=859399 2. https://github.com/sipwise/kamailio/tree/master/modules/kazoo
On 03/04/17 17:56, Luis Azedo wrote:
Hi Luis,
Thanks for the feedback
When I receive the messages using the Qpid Proton C++ client library (it talks to RabbitMQ using AMQP 1.0), it receives binary messages.
Does your code send them in to RabbitMQ using type binary or string?
If you submit the body as a string, do you believe RabbitMQ server is changing the type from string to binary?
Regards,
Daniel