[rabbitmq-discuss] JSON Data to be send between Java Producer and Python Consumer

subhankar biswas neo20iitkgp at gmail.com
Tue Apr 30 19:20:31 BST 2013


did u tried this settings at pub end 
  channel.basicPublish(*exchangeName*, *routingKey*,

                     *new* AMQP.BasicProperties.Builder()
                       .contentType("application/json").deliveryMode(2)
                       .priority(1).userId("bob")
                       .build()),
                     messageBodyBytes);


On Saturday, 20 April 2013 12:08:49 UTC+5:30, Arun Viswanath wrote:
>
> Hi, 
>
> I'm facing an issue while sending the JSON data between Java Producer and 
>  Python Consumer. 
>
> I doing the following serialization in my Java Producer for my JSON data 
> and placing the serialize data in the Queue 
>
> *Java Code: 
> import org.json.simple.JSONObject; 
> import org.json.simple.parser.JSONParser; 
>
>
> // Reading the JSON content from the file and making it an JSONObject 
> JSONObject serviceObj = (JSONObject) parser.parse(new 
> FileReader("C:\\Msg2.json")); 
>
> String jsonText = new flexjson.JSONSerializer().serialize(jsonObj); 
>
> channel.basicPublish("", CONDUCTOR_QUEUE_NAME, null, jsonText .getBytes());
> *
>
> ----------------- 
> My python consumer successfully takes the data from the Queue but it is 
> not able to process it. 
> Python consumer is expected to deserialize the json message read from the 
> Queue to Python dictionary but the data got after deserialize is python 
> unicode type. 
>
> My python consumer is third party code so I can't change my consumer side. 
> I'm not sure whether I'm doing the correct stuff in my Java producer. 
>
> Any help to resolve this issue will be appreciated. 
>
> Thanks In Advance, 
> Arun V 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130430/e962dd55/attachment.htm>


More information about the rabbitmq-discuss mailing list