There is a reflection API for protocol buffers that would allow you to
easily create an XML representation:
http://code.google.com/apis/protocolbuffers/docs/reference/cpp/google.protobuf.message.html#Reflection
The XQilla query processor used in the XML Exchange can accept data in a
variety of ways, I will be changing it to serialize message content as
an istream in the near future. The easiest way to support Protocol
Buffers would be to set a Mime Type in the message so it's clear that
it's a Protocol Buffer, then have the serializer use the Protocol Buffer
Reflection API to serialize the message as XML, so the existing XML
Exchange can query and route it. The same approach could be used for JSON.
I'd be glad to help with this.
Jonathan
John O'Hara wrote:
I thought that PB didn't have tagged data like XML does? So how would the
broker find out the message definitions?
Won't that make it awkward for jquery/xquery - or am I missing something?
Nice idea though.
John
2009/2/17 Carl Trieloff <[email protected]>
Joshua Kramer wrote:
Howdy Folks,
I wanted to throw out an idea. Is anybody using QPid to pass messages
based on Google's Protocol Buffers (PB)? Would it be beneficial to write an
exchange that routes messages based on something like a jquery, only on PB
messages instead of XML?
I am using Protocol Buffers in a blog I'm creating. The front end, based
in Django, sends requests via PB through Qpid to some Rpython-based modeling
software I wrote. PB took less time to implement in Python than a
comparable XML solution would have taken.
From the PB site: "Protocol buffers are what you use if your network link
is already saturated and your CPU's are already overused." They are 3 to 10
times smaller, and 20 to 100 times faster than XML. You write a definition
of your data's structure, then the PB compiler will give you objects in
Java, Python, or C++. Far easier to use than XML.
http://code.google.com/apis/protocolbuffers/
Cheers,
-Josh
Josh,
I expect it would be quite easy to do, I have skimmed the PB stuff. The XML
XQuery exchange is a plugin to the broker which is much
the same pattern and can be found here
https://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/src/qpid/xml/
As you can see, it subclasses the exchange, and when the plugin loads it
registers the XQuery exchange. This part would be 90%
the same for PB plugin.
In
https://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/src/qpid/xml/XmlExchange.cppyou
would have to re-implement specifically for PB,
i.e. how you want binding specified, and what lib to call on the PB side,
or code the routing part.
I would copy the xml dir to protocolBuffer dir and use these 4 files as the
starting point for a PB exchange plug-in.
Finally, there is a .mk one level up that will need the PB plugin added to
the make process. If you do the PB stuff etc, I'll be glad to help
with the project integration stuff.
regards
Carl.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]