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/18 08:13:30 UTC

multi service

if i write more than one Service,like this:
#### test.thrift
service Service1{
    void service1()
}
service Service2{
    void service2()
}

that i must write two classes to implement them?
if i wite two classes,how to bind them in server?because i found that one server only can bind one service ,like this:
##### server.code of Java
Processor processor=null;
TServerSocket socket=null;
TBinaryProtocol.Factory factory=null;
TServer server=null;

processor=new Service1.Processor(new Service1Impl());        // my question is here:how to bind the Serive2?
socket=new TServerSocket(7911);
factory=new TBinaryProtocol.Factory();
server=new TThreadPoolServer(processor,socket,factory);
server.serve();

2011-03-18 



mickey.guoyun 

Re: multi service

Posted by Bryan Duxbury <br...@rapleaf.com>.
You can make another service that inherits from those two, and then use the
processor for that. There are examples of services that inherit from one
another in the Thrift examples.

On Fri, Mar 18, 2011 at 12:13 AM, mickey.guoyun <mi...@gmail.com>wrote:

> if i write more than one Service,like this:
> #### test.thrift
> service Service1{
>    void service1()
> }
> service Service2{
>    void service2()
> }
>
> that i must write two classes to implement them?
> if i wite two classes,how to bind them in server?because i found that one
> server only can bind one service ,like this:
> ##### server.code of Java
> Processor processor=null;
> TServerSocket socket=null;
> TBinaryProtocol.Factory factory=null;
> TServer server=null;
>
> processor=new Service1.Processor(new Service1Impl());        // my question
> is here:how to bind the Serive2?
> socket=new TServerSocket(7911);
> factory=new TBinaryProtocol.Factory();
> server=new TThreadPoolServer(processor,socket,factory);
> server.serve();
>
> 2011-03-18
>
>
>
> mickey.guoyun
>