ebin123456 / py-amqplib

Automatically exported from code.google.com/p/py-amqplib
GNU Lesser General Public License v2.1
0 stars 0 forks source link

Message property with table type (e.g. application_headers) should give error for values of unserializable type. #17

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Which version of amqplib are you using?
0.6.1

Have you checked to see if there is a newer version in the "Featured
Downloads" section of the front page of this project?
Yes

Which broker are you using (RabbitMQ?) which version?
RabbitMQ 1.7.2

Which version of Python?
2.5.2

What steps will reproduce the problem?
Publish a message with an application_headers value that is not 
serializable by the Message class (e.g. None, object()):
chan.basic_publish(Message(application_headers=dict(test=None)), '')

What is the expected output? What do you see instead?
There should be an error raised.
The message is not sent and connection is just silently being dropped. An 
error is also being displayed in the logs of RabbitMQ indicating that the 
message can not be parsed. I think RabbitMQ can also solve this problem by 
throwing an error to the client that the message is malformed, but the 
client (amqplib) should not be sending malformed message in the first 
place. To fix this, if the type of the value is unsupported, an error 
should be raised.

Original issue reported on code.google.com by myrtac...@gmail.com on 1 Mar 2010 at 6:37

GoogleCodeExporter commented 9 years ago
Thanks, I added some unittests to check for this, and added code to raise a 
ValueError instead of screwing up the Connection.   All in Revision 5158ed99d9cf

Original comment by barry.pe...@gmail.com on 28 Mar 2011 at 8:05