Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-518

as3/flash/flex generator

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.3
    • None
    • None
    • Patch Available

    Description

      There's been various mailing list discussions about ActionScript 3 support, but I didn't see an associated JIRA so I thought I'd create one.

      The goal would be to allow a Flash or Flex project to call a Thrift service as an alternative to Flash's built-in web services and RPC implementations. A developer might want to use Thrift instead of SOAP, REST or AMF for it's code generation, strong typing, or for interoperability with existing Thrift-based services.

      The Flash code would look something like:

      public function testFunction() {
        var client:Service = new ServiceImpl(new TBinaryProtocol(
               new THttpClient(new URLRequest("http://service.com")));
        client.ping("hello world", handlePingResponse);
      }      
      
      private function handlePingResponse(response:String):void {
        trace("RESPONSE: " + response);
      }
      

      where Service is the generated Flash interface, ServiceImpl is the generated client which implements Service, and THttpClient is an implementation of TTransport.

      Note that Flash is a single-threaded environment so the call is necessarily asynchronous.

      The attached patch is a first-pass at an implementation. It's basically a line-for-line partial port of the java lib and generator. The lib contains a single protocol (TBinaryProtocol) and a single transport (THttpClient), along with a generator which generates the interface and client implementation (server implementation is skipped since this seems unlikely to be useful). It still needs some work – it's untested except for the specific thrift services we use internally, and needs documentation and cleanup. I'm happy to do this work if there's general interest in adding as3 support - let me know.

      Attachments

        1. thrift_as3.diff
          147 kB
          Dave Lerman
        2. thrift_as3.diff
          147 kB
          Dave Lerman
        3. cleaner.patch
          163 kB
          Aron Sogor

        Activity

          People

            sogor Aron Sogor
            dlerman Dave Lerman
            Votes:
            5 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: