From fab85bae182afb76376026162f81b35ea8b2687d Mon Sep 17 00:00:00 2001 From: Piotr Maslanka <piotr.maslanka@henrietta.com.pl> Date: Sat, 28 Jan 2017 23:45:26 +0100 Subject: [PATCH] caveats --- docs/caveats.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 docs/caveats.md diff --git a/docs/caveats.md b/docs/caveats.md new file mode 100644 index 0000000..6cf5f33 --- /dev/null +++ b/docs/caveats.md @@ -0,0 +1,19 @@ +# Caveats + +Things to look out for + + +## memoryviews + +Since CoolAMQP tries to be fast, it uses memoryviews everywhere. _ReceivedMessage_ objects, and message +properties therefore, are memoryviews. So, it you wanted to read the routing key a message was sent with, +or message's encoding, you should do: + +```python +received_msg.routing_key.to_bytes() +received_msg.properties.content_encoding.to_bytes() +``` + +Only the _body_ property of the message will be a byte object (and not even that it you set an option +in Cluster.consume). + -- GitLab