[rabbitmq-discuss] channel.basicPublish - sending json data

Aljosa Mohorovic aljosa.mohorovic at gmail.com
Fri Jul 3 15:07:47 BST 2009


i'm trying to use channel.basicPublish to send json encoded data but
with no luck.
there is com.rabbitmq.tools.json.JSONWriter but i have no idea how
should it be used?
could somebody point me to some related docs or post a simple example?

i was trying to encode HashMap to json and then use something like:
-----------------------------------------------------------------------------------------
AMQP.BasicProperties prop = new AMQP.BasicProperties();
prop.contentType = "application/json";
prop.contentEncoding = "utf-8";
channel.basicPublish("ex", "route", prop, msg);
-----------------------------------------------------------------------------------------

i did try to find something useful in rabbitmq archives but there is
only one message that mentions JSONWriter.
any tips/comments appreciated.

Aljosa Mohorovic




More information about the rabbitmq-discuss mailing list