veegee / amqpy

Pure-Python 2 & 3 AMQP client library
http://amqpy.readthedocs.org/
Other
32 stars 5 forks source link

Message body are bytes.. #18

Closed gst closed 9 years ago

gst commented 9 years ago

When I publish some message through the rabbitmq admin interface (localhost:15672), the message body as received in my consumer is bytes..

While for messages I've published with a regular publisher the message body got in the consumer is text/str ..

is it expected ?

veegee commented 9 years ago

You have to set the Content-Type header appropriately. If it is set correctly, the library auto-decodes it. You can disable auto decoding if you like: http://amqpy.readthedocs.org/en/latest/amqpy.channel.html?highlight=auto_decode

gst commented 9 years ago

NB: it's only the _contentencoding property (not header) that was needed to be set in my case.

veegee commented 9 years ago

Ah, sorry, you're right. It's the content_encoding: http://amqpy.readthedocs.org/en/latest/amqpy.message.html#amqpy.message.Message.__init__