[rabbitmq-discuss] Json rabbitmq

Jerry Kuch jerryk at vmware.com
Sat Nov 5 23:35:08 GMT 2011


Hi, Lianlupeng...

Can you say a little more about what precisely you want to do?  By the form
of your question I assume you're working with the Java client, or perhaps
the .NET one?

If you want to do an RPC-like communication using JSON as the marshaling format
you can use the JsonRpcClient and JsonRpc Server classes outright, and they will
hide many lower level details for you.

If you just want to serialize data for publication, or de-serialize it after
consuming it, JSONReader and JSONWriter are fairly straightforward to use and
the source code for JsonRpcClient and JsonRpcServer will provide good examples
of how JSONWriter and JSONReader are used.  In particular looking at the source
for the 'call(String, Object[]) --> Object' method on JsonRpcClient should be
instructive as it illustrates building up a hash map from Strings to Objects
that will represent your JSON payload, and making a JSON String out of it using
the writer, which you can then publish.  The 'doCall(String) --> String method'
in JsonRpcServer shows you the complementary code on the other side, where a
String containing JSON is cracked apart into a map from Strings to Objects that
you can deal with as you like.

Best regards,
Jerry

----- Original Message -----
From: "魔哥" <lianlupeng at gmail.com>
To: rabbitmq-discuss at lists.rabbitmq.com
Sent: Saturday, November 5, 2011 6:56:15 AM
Subject: [rabbitmq-discuss] Json rabbitmq


Hi all




i am now using RabbitMQ in my project ,and then i need to send Json data from a server to a client how can i use JSONReader and JSONWriter to do job? 


thanks!


--
by lianlupeng.

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss


More information about the rabbitmq-discuss mailing list