Apache Thrift
Apache Thrift
Main page

Apache Thrift

logo
Community Hub0 subscribers
What are your thoughts?
Be the first to start a discussion here.
Be the first to start a discussion here.
Apache Thrift

Thrift is an interface definition language and binary communication protocol used for defining and creating services for programming languages. It was developed by Facebook. Since 2008, it is an open source project in the Apache Software Foundation.

It uses a remote procedure call (RPC) framework and combines a software stack with a code generation engine to build cross-platform services. Thrift can connect applications written in a variety of languages and frameworks, including ActionScript, C, C++, C#, Cocoa, Delphi, Erlang, Go, Haskell, Java, JavaScript, Objective-C, OCaml, Perl, PHP, Python, Ruby, Elixir, Rust, Scala, Smalltalk, and Swift. The implementation was described in an April 2007 technical paper released by Facebook, now hosted on Apache.

Thrift includes a complete stack for creating clients and servers. The top part is generated code from the Thrift definition. From this file, the services generate client and processor codes. In contrast to built-in types, created data structures are sent as a result of generated code. The protocol and transport layer are part of the runtime library. With Thrift, it is possible to define a service and change the protocol and transport without recompiling the code. Besides the client part, Thrift includes server infrastructure such as blocking, non-blocking, and multi-threaded servers. The underlying I/O part of the stack is implemented differently for different programming languages.

Thrift supports a number of protocols:

The supported transports are:

Thrift also provides a number of servers, which are:

Thrift is written in C++, but can create code for some other programming languages. To create a Thrift service, one has to write Thrift files that describe it, generate the code in the destination language, write some code to start the server, and call it from the client. An example of such a description file:

Thrift will generate the code out of this descriptive information. For instance, in Java, the PhoneType will be enum inside the Phone class.

See all
User Avatar
No comments yet.