You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by "mickey.guoyun" <mi...@gmail.com> on 2011/03/16 11:36:48 UTC

how to code more than one thrift?

Hi,every one.I am a new to thrift.follow the wiki,i can use thrift to deploy RPC project.but i have two problems:
1.
I write all service,struct,exception into one thrift file.if we have updated the requirment (so that we must modify thrift file),
and recompile the thrift file to build kinds of language's source code what we want to.
so i want to write more than one thrift file ,if we need to update,we only need to add or modify small amounts of thrift file.
thfit has this function?if ture,please give me a example.
2.
we use Java to write Server,and use PHP to write Client.but we found that ,if Java's Server return boolean(true or false),the Php's Client will receive null.i think may be we must return Boolean object.

Thank you very much!

2011-03-16 



mickey.guoyun 

Re: how to code more than one thrift?

Posted by Rush Manbert <ru...@manbert.com>.
On Mar 16, 2011, at 3:36 AM, mickey.guoyun wrote:

> Hi,every one.I am a new to thrift.follow the wiki,i can use thrift to deploy RPC project.but i have two problems:
> 1.
> I write all service,struct,exception into one thrift file.if we have updated the requirment (so that we must modify thrift file),
> and recompile the thrift file to build kinds of language's source code what we want to.
> so i want to write more than one thrift file ,if we need to update,we only need to add or modify small amounts of thrift file.
> thfit has this function?if ture,please give me a example.
> 2.
> we use Java to write Server,and use PHP to write Client.but we found that ,if Java's Server return boolean(true or false),the Php's Client will receive null.i think may be we must return Boolean object.


Hi Mickey,

I can only address your first question, because I'm a C++ user of thrift.

I believe there is still a tutorial subdirectory in the thrift source distro. (I also use an older version of thrift, so haven't downloaded the source for quite a while.) The tutorial has tutorial.thrift and shared.thrift, and shared.thrift is included by tutorial.thrift.

This is the general pattern. You can include thrift IDL files in other thrift IDL files. We have adopted the standard of using *.thriftclass as the name of a thrift IDL file that just defines thrift structs, and *.thriftservice as the name of a thrift IDL file that defines a service. The thriftservice files always need to include the thriftclass files. 

Best regards,
Rush