diff --git a/docs/caveats.md b/docs/caveats.md new file mode 100644 index 0000000000000000000000000000000000000000..6cf5f33fa5ff8810b15af3daf6b8f12a5898e4a0 --- /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). +