When I started Bibale (www.bibale.com) which is a GWT app, I was
looking at protobufs and Thrift for the backend. The lack of RPC
framework in the Open Source release of protobufs made me go with
Thrift in the end.

Once Thrift was chosen, I looked at ways to extend it so both the
services and objects could easily be manipulated on the client (GWT)
side. I first came up with a solution which is described in
THRIFT-137, but the heavy use of java.lang.reflect lead to poor
performance, so I decided to give it a second shot and made new
changes to the compiler to generate better performing conversion
methods between *pure* Thrift objects and GWT compatible versions.

My current modifications to the Java generator are the following:

- a 'gwt' option that generates GWT compatible classes (not extending
TBase, not defining Metadata) located in a 'gwt' subpackage of the
namespace declared in the IDL file.
- a 'gwtready' option that generated standard Thrift classes which
also implement a GWTReady interface which has two methods, Thrift2GWT
and GWT2Thrift which convert between Thrift/GWT compatible instances.
This option also creates GWT compatible service interfaces (including
an async interface).

Those two combined allow the use in GWT client code of objects which
mirror their Thrift counterpart. The services consumed by the GWT
client code take GWT compatible objects as parameters and calls can
simply be forwarded to a pure Thrift service with simple uses of
Thrift2GWT and GWT2Thrift.

If anyone is interested please let me know, I'll put together a patch
and will create a New Feature issue in Jira.

Mathias.

Reply via email to