FAQ
Hi,

Can I have more than one interface being served by the same TServer?

I'm using a TServerSocket and wanted to have more than one interface
being served in the same port.
I started to implement a TProcessor that has a processMap with the
methods of all the interfaces, but now I have a naming collision and
can no longer use this approach.

To get things going I had a prefix to the operations of each
interface, but that feels like a really bad hack.
I also went to change the generated code to have the prefix only in
the process map and the TMessage, but this is not a better hack, since
now I can't give my idl to someone to implement a client that works
with my service.

Thanks,

Marlene

Search Discussions

  • Bryan Duxbury at Feb 14, 2011 at 4:26 pm
    There's currently no clean way to do this. A while back, there were some
    proposals on how we could support this directly, but they did not get fully
    implemented. I think it was James King and his "channels" proposal that you
    might want to look for in the mailing list archive.

    On Mon, Feb 14, 2011 at 5:05 AM, Marlene Marques
    wrote:
    Hi,

    Can I have more than one interface being served by the same TServer?

    I'm using a TServerSocket and wanted to have more than one interface
    being served in the same port.
    I started to implement a TProcessor that has a processMap with the
    methods of all the interfaces, but now I have a naming collision and
    can no longer use this approach.

    To get things going I had a prefix to the operations of each
    interface, but that feels like a really bad hack.
    I also went to change the generated code to have the prefix only in
    the process map and the TMessage, but this is not a better hack, since
    now I can't give my idl to someone to implement a client that works
    with my service.

    Thanks,

    Marlene
  • Tony Kinnis at Feb 14, 2011 at 5:25 pm
    This is not exactly what you were looking for but as an alternative you can
    emulate this over HTTP by mapping your different services to URLs. Of course,
    you'll have additional overhead with HTTP but you can support many different
    services on a single server:port. I am currently doing this using Netty as my
    http server and it works very well.


    ----- Original Message ----
    From: Bryan Duxbury <bryan@rapleaf.com>
    To: user@thrift.apache.org
    Sent: Mon, February 14, 2011 8:25:39 AM
    Subject: Re: Multiple interfaces handled by the same TServer

    There's currently no clean way to do this. A while back, there were some
    proposals on how we could support this directly, but they did not get fully
    implemented. I think it was James King and his "channels" proposal that you
    might want to look for in the mailing list archive.

    On Mon, Feb 14, 2011 at 5:05 AM, Marlene Marques
    wrote:
    Hi,

    Can I have more than one interface being served by the same TServer?

    I'm using a TServerSocket and wanted to have more than one interface
    being served in the same port.
    I started to implement a TProcessor that has a processMap with the
    methods of all the interfaces, but now I have a naming collision and
    can no longer use this approach.

    To get things going I had a prefix to the operations of each
    interface, but that feels like a really bad hack.
    I also went to change the generated code to have the prefix only in
    the process map and the TMessage, but this is not a better hack, since
    now I can't give my idl to someone to implement a client that works
    with my service.

    Thanks,

    Marlene
  • Marlene Marques at Feb 28, 2011 at 11:07 pm
    Hi,

    I went through the issues in the project and found a ticket about
    multiplexing services [1], that looks like one of my approaches. I was
    curious why it wasn't committed. Is it for lack of support in other
    languages or you think the feature isn't worthy.

    [1] - https://issues.apache.org/jira/browse/THRIFT-563

    On Mon, Feb 14, 2011 at 5:24 PM, Tony Kinnis wrote:
    This is not exactly what you were looking for but as an alternative you can
    emulate this over HTTP by mapping your different services to URLs. Of course,
    you'll have additional overhead with HTTP but you can support many different
    services on a single server:port. I am currently doing this using Netty as my
    http server and it works very well.


    ----- Original Message ----
    From: Bryan Duxbury <bryan@rapleaf.com>
    To: user@thrift.apache.org
    Sent: Mon, February 14, 2011 8:25:39 AM
    Subject: Re: Multiple interfaces handled by the same TServer

    There's currently no clean way to do this. A while back, there were some
    proposals on how we could support this directly, but they did not get fully
    implemented. I think it was James King and his "channels" proposal that you
    might want to look for in the mailing list archive.

    On Mon, Feb 14, 2011 at 5:05 AM, Marlene Marques
    wrote:
    Hi,

    Can I have more than one interface being served by the same TServer?

    I'm using a TServerSocket and wanted to have more than one interface
    being served in the same port.
    I started to implement a TProcessor that has a processMap with the
    methods of all the interfaces, but now I have a naming collision and
    can no longer use this approach.

    To get things going I had a prefix to the operations of each
    interface, but that feels like a really bad hack.
    I also went to change the generated code to have the prefix only in
    the process map and the TMessage, but this is not a better hack, since
    now I can't give my idl to someone to implement a client that works
    with my service.

    Thanks,

    Marlene


  • Nevo Hed at Mar 10, 2011 at 7:36 pm
    *Is the one port essential or is the desire just to run in a single thread?
    *

    THRIFT-563 looks like a great idea, but requires mods to clients

    a few days ago I realized that I may need to use a similar solution soon,
    so I looked at TNonblockingServer (uses libevent)

    I figured one could create a server that can create multiple TNBS instances
    and link them to this server.

    This new server's 'serve' method would share a single eventBase_ (from
    libevent).

    Yes, I would have multiple ports, but a single threaded

    Did I miss anything?

    Thanks
    -Nevo



    On Mon, Feb 28, 2011 at 6:06 PM, Marlene Marques
    wrote:
    Hi,

    I went through the issues in the project and found a ticket about
    multiplexing services [1], that looks like one of my approaches. I was
    curious why it wasn't committed. Is it for lack of support in other
    languages or you think the feature isn't worthy.

    [1] - https://issues.apache.org/jira/browse/THRIFT-563

    On Mon, Feb 14, 2011 at 5:24 PM, Tony Kinnis wrote:
    This is not exactly what you were looking for but as an alternative you can
    emulate this over HTTP by mapping your different services to URLs. Of course,
    you'll have additional overhead with HTTP but you can support many different
    services on a single server:port. I am currently doing this using Netty as my
    http server and it works very well.


    ----- Original Message ----
    From: Bryan Duxbury <bryan@rapleaf.com>
    To: user@thrift.apache.org
    Sent: Mon, February 14, 2011 8:25:39 AM
    Subject: Re: Multiple interfaces handled by the same TServer

    There's currently no clean way to do this. A while back, there were some
    proposals on how we could support this directly, but they did not get fully
    implemented. I think it was James King and his "channels" proposal that you
    might want to look for in the mailing list archive.

    On Mon, Feb 14, 2011 at 5:05 AM, Marlene Marques
    wrote:
    Hi,

    Can I have more than one interface being served by the same TServer?

    I'm using a TServerSocket and wanted to have more than one interface
    being served in the same port.
    I started to implement a TProcessor that has a processMap with the
    methods of all the interfaces, but now I have a naming collision and
    can no longer use this approach.

    To get things going I had a prefix to the operations of each
    interface, but that feels like a really bad hack.
    I also went to change the generated code to have the prefix only in
    the process map and the TMessage, but this is not a better hack, since
    now I can't give my idl to someone to implement a client that works
    with my service.

    Thanks,

    Marlene




    --
    Nevo Hed

    nhed@bamboo-entertainment.com
    617-302-6175
  • Marlene Marques at Mar 11, 2011 at 3:00 pm
    Yes, in my particular case one port is required, because i'm building
    a generic thrift proxy where multiples services will be registered
    (don't know them at build time).

    For now I went with this approach, and will probably need to integrate
    this feature in some of the other languages. I'll send a patch when
    this is ready.

    I was just trying to figure out if it was a feature of interest or
    someone had a better way to do it before I start to implement it
    myself.

    Thanks

    Marlene
    On Thu, Mar 10, 2011 at 7:35 PM, Nevo Hed wrote:
    Is the one port essential or is the desire just to run in a single thread?


    THRIFT-563 looks like a great idea, but requires mods to clients

    a few days ago I realized that I may need to use a similar solution soon,
    so I looked at TNonblockingServer (uses libevent)

    I figured one could create a server that can create multiple TNBS instances
    and link them to this server.

    This new server's 'serve' method would share a single eventBase_ (from
    libevent).

    Yes, I would have multiple ports, but a single threaded

    Did I miss anything?

    Thanks
    -Nevo


    On Mon, Feb 28, 2011 at 6:06 PM, Marlene Marques wrote:

    Hi,

    I went through the issues in the project and found a ticket about
    multiplexing services [1], that looks like one of my approaches. I was
    curious why it wasn't committed. Is it for lack of support in other
    languages or you think the feature isn't worthy.

    [1] - https://issues.apache.org/jira/browse/THRIFT-563

    On Mon, Feb 14, 2011 at 5:24 PM, Tony Kinnis wrote:
    This is not exactly what you were looking for but as an alternative you
    can
    emulate this over HTTP by mapping your different services to URLs. Of
    course,
    you'll have additional overhead with HTTP but you can support many
    different
    services on a single server:port. I am currently doing this using Netty
    as my
    http server and it works very well.


    ----- Original Message ----
    From: Bryan Duxbury <bryan@rapleaf.com>
    To: user@thrift.apache.org
    Sent: Mon, February 14, 2011 8:25:39 AM
    Subject: Re: Multiple interfaces handled by the same TServer

    There's currently no clean way to do this. A while back, there were some
    proposals on how we could support this directly, but they did not get
    fully
    implemented. I think it was James King and his "channels" proposal that
    you
    might want to look for in the mailing list archive.

    On Mon, Feb 14, 2011 at 5:05 AM, Marlene Marques
    wrote:
    Hi,

    Can I have more than one interface being served by the same TServer?

    I'm using a TServerSocket and wanted to have more than one interface
    being served in the same port.
    I started to implement a TProcessor that has a processMap with the
    methods of all the interfaces, but now I have a naming collision and
    can no longer use this approach.

    To get things going I had a prefix to the operations of each
    interface, but that feels like a really bad hack.
    I also went to change the generated code to have the prefix only in
    the process map and the TMessage, but this is not a better hack, since
    now I can't give my idl to someone to implement a client that works
    with my service.

    Thanks,

    Marlene




    --
    Nevo Hed

    nhed@bamboo-entertainment.com
    617-302-6175

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriesthrift
postedFeb 14, '11 at 1:06p
activeMar 11, '11 at 3:00p
posts6
users4
websitethrift.apache.org
irc#thrift

People

Translate

site design / logo © 2022 Grokbase