[rabbitmq-discuss] RabbitMQ Consumer Error

Alexis Richardson alexis.richardson at gmail.com
Fri Jul 17 12:02:06 BST 2009


Excellent - have you mentioned this to the Carrot folks?


On Mon, Jul 13, 2009 at 6:31 AM, Lynton
Grice<lynton.grice at logosworld.com> wrote:
> Hi there,
>
>
>
> I seemed to have solved the issue....it all had to do with the
> “content_encoding”....so I replaced this:
>
>
>
> Content = #content{class_id = 60,
>
>                      properties = amqp_util:basic_properties(),
>
>                      properties = Properties,
>
>                      properties_bin = none,
>
>                      payload_fragments_rev = [Payload]
>
>                     },
>
>
>
> With this:
>
>
>
> Properties = #'P_basic'{content_type = <<"application/octet-stream">>,
>
>                        content_encoding = <<"binary">>,
>
>                       delivery_mode = 1,
>
>                       priority = 0},
>
>                 Content = #content{class_id = 60,
>
>                      properties = Properties,
>
>                      properties_bin = none,
>
>                      payload_fragments_rev = [Payload]
>
>                     },
>
>
>
> Now my Python consumer in CARROT is working 100% ;-)
>
>
>
> Chat later
>
>
>
> Lynton
>
> From: rabbitmq-discuss-bounces at lists.rabbitmq.com
> [mailto:rabbitmq-discuss-bounces at lists.rabbitmq.com] On Behalf Of Lynton
> Grice
> Sent: 12 July 2009 07:13 PM
> To: rabbitmq-discuss at lists.rabbitmq.com
> Subject: [rabbitmq-discuss] RabbitMQ Consumer Error
>
>
>
> 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
>
>
>
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>




More information about the rabbitmq-discuss mailing list