You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "qiutao (JIRA)" <ji...@apache.org> on 2011/05/06 19:20:03 UTC

[jira] [Created] (THRIFT-1163) How can i use multi service in one program?

How can i use multi service in one program?
-------------------------------------------

                 Key: THRIFT-1163
                 URL: https://issues.apache.org/jira/browse/THRIFT-1163
             Project: Thrift
          Issue Type: Question
          Components: C++ - Library
    Affects Versions: 0.6.1
            Reporter: qiutao
             Fix For: 0.6.1


For example,i have two service like this:
service FirstService
{
	string hello()
}

service SecondService
{
	string hello()
}
the generated code have two skeleton server file,how can i use them in one program?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (THRIFT-1163) How can i use multi service in one program?

Posted by "Jake Farrell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1163?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jake Farrell resolved THRIFT-1163.
----------------------------------

    Resolution: Not A Problem
      Assignee: Jake Farrell

Please ask questions like this to the user or dev mailing list. You are able to have multiple service blocks within one definition file. The compiler will generate separate files for each service as shown below. 

gen-cpp/
|-- FirstService.cpp
|-- FirstService.h
|-- FirstService_server.skeleton.cpp
|-- SecondService.cpp
|-- SecondService.h
|-- SecondService_server.skeleton.cpp
|-- test_constants.cpp
|-- test_constants.h
|-- test_types.cpp
`-- test_types.h

gen-java/
|-- FirstService.java
`-- SecondService.java


> How can i use multi service in one program?
> -------------------------------------------
>
>                 Key: THRIFT-1163
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1163
>             Project: Thrift
>          Issue Type: Question
>          Components: C++ - Library
>    Affects Versions: 0.6.1
>            Reporter: qiutao
>            Assignee: Jake Farrell
>              Labels: features
>             Fix For: 0.6.1
>
>
> For example,i have two service like this:
> service FirstService
> {
> 	string hello()
> }
> service SecondService
> {
> 	string hello()
> }
> the generated code have two skeleton server file,how can i use them in one program?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Issue Comment Edited] (THRIFT-1163) How can i use multi service in one program?

Posted by "Dragan Okiljevic (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13030071#comment-13030071 ] 

Dragan Okiljevic edited comment on THRIFT-1163 at 5/6/11 6:25 PM:
------------------------------------------------------------------

You would need to launch two instances of thrift server from your program, each instance for one service and these two servers would need to listen to different ports. (Use fork(), thrift thread implementation or something else to launch servers at a same time).

There is also another solution available as a patch: a single server that multiplexes services. Take a look at THRIFT-66 and THRIFT-563 for multiplexing services.

      was (Author: dragan.okiljevic):
    You would need to launh two instances of thrift server from your program, each instance for one service and these two servers would need to listen to different ports. (Use fork(), thrift thread implementation or something else to launch servers at a same time).

There is also another solution available as a patch: a single server that multiplexes services. Take a look at THRIFT-66 and THRIFT-563 for multiplexing services.
  
> How can i use multi service in one program?
> -------------------------------------------
>
>                 Key: THRIFT-1163
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1163
>             Project: Thrift
>          Issue Type: Question
>          Components: C++ - Library
>    Affects Versions: 0.6.1
>            Reporter: qiutao
>            Assignee: Jake Farrell
>              Labels: features
>             Fix For: 0.6.1
>
>
> For example,i have two service like this:
> service FirstService
> {
> 	string hello()
> }
> service SecondService
> {
> 	string hello()
> }
> the generated code have two skeleton server file,how can i use them in one program?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (THRIFT-1163) How can i use multi service in one program?

Posted by "qiutao (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13030459#comment-13030459 ] 

qiutao commented on THRIFT-1163:
--------------------------------

Thanks all.

May be this is a shortcomings that can't use multiple services in one instance.


> How can i use multi service in one program?
> -------------------------------------------
>
>                 Key: THRIFT-1163
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1163
>             Project: Thrift
>          Issue Type: Question
>          Components: C++ - Library
>    Affects Versions: 0.6.1
>            Reporter: qiutao
>            Assignee: Jake Farrell
>              Labels: features
>             Fix For: 0.6.1
>
>
> For example,i have two service like this:
> service FirstService
> {
> 	string hello()
> }
> service SecondService
> {
> 	string hello()
> }
> the generated code have two skeleton server file,how can i use them in one program?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (THRIFT-1163) How can i use multi service in one program?

Posted by "Dragan Okiljevic (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13030071#comment-13030071 ] 

Dragan Okiljevic commented on THRIFT-1163:
------------------------------------------

You would need to launh two instances of thrift server from your program, each instance for one service and these two servers would need to listen to different ports. (Use fork(), thrift thread implementation or something else to launch servers at a same time).

There is also another solution available as a patch: a single server that multiplexes services. Take a look at THRIFT-66 and THRIFT-563 for multiplexing services.

> How can i use multi service in one program?
> -------------------------------------------
>
>                 Key: THRIFT-1163
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1163
>             Project: Thrift
>          Issue Type: Question
>          Components: C++ - Library
>    Affects Versions: 0.6.1
>            Reporter: qiutao
>            Assignee: Jake Farrell
>              Labels: features
>             Fix For: 0.6.1
>
>
> For example,i have two service like this:
> service FirstService
> {
> 	string hello()
> }
> service SecondService
> {
> 	string hello()
> }
> the generated code have two skeleton server file,how can i use them in one program?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira