You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (JIRA)" <ji...@apache.org> on 2014/02/16 20:00:19 UTC

[jira] [Commented] (THRIFT-2366) Running Thrift in a single process / as a foreign function interface

    [ https://issues.apache.org/jira/browse/THRIFT-2366?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13902782#comment-13902782 ] 

Jens Geyer commented on THRIFT-2366:
------------------------------------

Short sketch/idea how it could work:
{code}
outer code
- setup a service client using stream transport
- call service client's xxx-send() function 
- pass stream data to inner module via dedicated function call
  - create processor instance
  - pass stream data as input, provide another stream for output data
    - call to inner code
  - return output stream data
- setup a service client using stream transport
- call service client's xxx-recv() function 
- return the data
{code}

I have already used approx. 75% of the pieces outlined above with Delphi and C# and I'm positive that the rest could work out as well (the swiss army knife again). Can't say much about how the Python code supports that today, or what needs to be done to achieve that with Python. 


> Running Thrift in a single process / as a foreign function interface
> --------------------------------------------------------------------
>
>                 Key: THRIFT-2366
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2366
>             Project: Thrift
>          Issue Type: Improvement
>            Reporter: Eric Christiansen
>
> I propose Thrift be enhanced by allowing the server and client to exist in the same thread.
> The user semantics would be similar to foreign function interfaces, such as those generated by SWIG.
> Please see this SO question: http://stackoverflow.com/questions/21211749/running-apache-thrift-in-a-single-process-as-a-foreign-function-interface
> Use case 1:
> Bob writes a CLI Python app that depends on C++ code.
> His users integrate his app into shell scripts, and are happy they don't have to worry about starting and stopping a Thrift server.
> Use case 2:
> Alice is an iOS developer who wants to combine Haskell and C.
> Forking processes isn't allowed in iOS, so before she couldn't start a Thrift server and get the desired combination.
> But now everything can live in a single thread, so she gets her polyglot programming.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)