Serializing Objects for Asynchronous Messaging

I am considering using AMQP (using qpid) so that a mixture of Python and Java services communicates with each other. The basic text messages seem simple enough, but, as with any other messaging technology that I explored, where it seems to stop. With the exception of creating instant messaging applications, I would have thought that sending strings was not particularly useful to make another example after the example demonstrates sending unformatted text around.

Then my instinct should use XML serialization (de-) or something similar (JSON, YAML, protocol buffers, etc.), which has good library support in both languages. Is this the best practice, and if so, what (de-) serialization protocol will people recommend? Or am I missing a point somewhere and should be enough to send small pieces of text?

+4
source share
3 answers

Owen, can I offer a few words about RabbitMQ.

AMQP is a binary protocol, and you can do much more than send strings! Which Python client do you plan to use? We recommend the Barry Pederson client for most applications: http://barryp.org/software/py-amqplib/ . You can always go to the RabbitMQ list and ask any questions that you like. attitude to your post and comments :-)

As James points out, JSON is good. RabbitMQ supports JSON-RPC through an HTTP connection to the back of AMQP. People also use RabbitMQ with Orbited for comet-type applications.

In addition, we are fans and support the XMPP and STOMP that James invented. STOMP is convenient for a certain class of messaging applications, and RabbitMQ supports it for both direct and thematic routing. We found a great way to interact with ActiveMQ, preferring it to JMS in this scenario.

I hope you find the right server for your use cases and recommend trying different combinations to achieve the best results.

Greetings

Alexis

+6
source

For what it's worth, I had good experience using AMQP + Protocol Buffers.

If the sender serializes the messages, you probably need to include the identifier in the header so that you know how to de-serialize on the receiving side. However, this is not so difficult.

+2
source

XML or JSON is probably the easiest. Protocol buffering is cool, but I will see it as an optimization that you need to think about later if you really need to (since it is a bit more difficult to use a mostly binary format).

By the way, you can look at Stomp, not AMQP; he received more client libraries and supported message brokers. for example Apache ActiveMQ , which is more popular than qpid or rabbitmq, or even any JMS will work fine.

+1
source

All Articles