News about my FOSS projects

Friday, March 5, 2010

On adding Hessian (RPC) support for Trac

Duke, the Java Mascot, in the waving pose. Duk...Image via Wikipedia Multi-protocol Trac RPC API

Yesterday was a historical date. In the morning I finally could request the data managed by a Trac instance via Hessian RPC. The whole story ? Well ... Few months ago Odd Simon Simonsen invited me to participate and send patches to the very popular and successful XmlRpcPlugin. In order to do that he cloned the SVN repository using Hgsvn, published its contents at Bitbucket and created an MQ repository. We are developing new patches in there. Right now we are both working on an API to support RPC calls via multiple protocols (beyond built-in XML-RPC and JSON-RPC implementations ;o). We needed a protocol to experiment with and tune up the current prototype. Hessian was the target for this research.

Subscribe using RSS

Hessian is a binary, dynamic, and very efficient RPC protocol. It's very popular in Java. Nonetheless (unlike others like RMI ...) it can be implemented on top of any language, and that includes Python as well. It's dynamic nature (similar to XML-RPC) helps with the bindings.

So far I'd not like to unveil the implementation details and the impact this might have on the underlying API (because changes will be applied soon ;o), but I'd like to show how to request data to Trac using this protocol. It's very simple !

>>> from hessian.client import HessianProxy as HSP
>>> auth = {'username' : 'olemis', 'password' : 'canhurtyoureyes'}
>>> hsp = HSP('http://localhost/trac/newprj/hessian', auth)
>>> getattr(hsp, 'system.getAPIVersion')()
[1, 1, 0]

That's it ! If you'd like to follow the development of this features then I invite you to subscribe to the RSS feed. Adding Hessian support for Trac is just the beginning to raise a wonderful plugins ecosystem ;o) . You should be able to access your data the way you want !

Reblog this post [with Zemanta]

No comments:

Post a Comment