[rabbitmq-discuss] RabbitMQ Consumer Error
Lynton Grice
lynton.grice at logosworld.com
Sun Jul 12 18:13:19 BST 2009
Hi there,
I wonder if someone can help me on this one. I am building the following
scenario:
Client -> Mochiweb -> RabbitMQ (via Erlang RabbitMQ Client code) -> Python
consumer (using the Python CARROT AMQP library)
I have everything working right until the Python consumer picks up the
message. I get the following error:
"No JSON object could be decoded"
Let me step back a second.....here is an example of the BINARY sent from
the Erlang client (inside Mochiweb) to RabbitMQ:
NOTE: I have simplified the call by just making a binary called "Hello
World" for "Payload"
Payload = <<"Hello World">>,
Content = #content{class_id = 60,
properties = amqp_util:basic_properties(),
properties_bin = none,
payload_fragments_rev = [Payload]
},
amqp_channel:cast(Channel, BasicPublish, Content),
When the Python JSON library (decoder.py) receives this I can see the
message is formatted like:
'Hello World'
But if I send to RabbitMQ like follows using PYTHON..
from carrot.messaging import Publisher
from carrot.connection import AMQPConnection
amqpconn = AMQPConnection(hostname="localhost", port=5672, userid="guest",
password="guest",vhost="/")
publisher = Publisher(connection=amqpconn, exchange="amq.direct",
routing_key="a.b.c.*")
publisher.send('Hello World')
publisher.close()
I get the following for the message in the Python JSON library (decoder.py):
'"Hello World"'
NOTE the subtle different between the two.....the first one is 'Hello World'
(from Erlang) and the second (from Python) is '"Hello World"'
I am just wondering if this is a "Unicode" thing or do I need to do
something to the Erlang BINARY before sending it to RabbitMQ?
I think this could also have to do with the BUILT IN JSON library in Python
2.6......I will look into that.....
Thanks for the help....much appreciated ;-)
Lynton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20090712/50856736/attachment.htm
More information about the rabbitmq-discuss
mailing list