[rabbitmq-discuss] Best practice for supporting both, XML and JSON messages

Julio Polo julio at hawaii.edu
Tue Nov 29 19:38:08 GMT 2011

Thanks everyone, so it sounds like it is not a huge aberration to
publish multiple representations of the same message.  I'll make sure
to set Content-type as well.  Tony, that's an interesting idea,
creating a separate process to do the translation.

Julio Polo
University of Hawaii

On Tue, Nov 29, 2011 at 3:44 AM, Tony Garnock-Jones
<tonygarnockjones+rabbitmq at gmail.com> wrote:
> On 28 November 2011 20:49, Julio Polo <julio at hawaii.edu> wrote:
>> Would it be unusual for a producer to publish two versions of every
>> message, one in XML, another in JSON?   If it's not unusual, is the
>> typical implementation to set up a separate exchange for each format?
> That would work fine. Another possibility is that if you can mechanically
> compute the one from the other, you might
> make your producers emit one (say, the JSON)
> have a special consumer program listening to the exchange for JSON-formatted
> messages, which
> translates each message into XML, and
> posts the translation back into the exchange (or a different one; or with a
> different routing key)
> So long as you make sure to tag messages with their MIME type in the
> content-type header, the translator process won't get confused. The benefit
> is that your producers are simpler, and the logic for understanding the
> equivalences between the JSON and the XML is gathered all in one place.
> Regards,
>   Tony

More information about the rabbitmq-discuss mailing list