Book Image

Learning Apache Thrift

Book Image

Learning Apache Thrift

Overview of this book

With modern software systems being increasingly complex, providing a scalable communication architecture for applications in different languages is tedious. The Apache Thrift framework is the solution to this problem! It helps build efficient and easy-to-maintain services and offers a plethora of options matching your application type by supporting several popular programming languages, including C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, OCaml, and Delphi. This book will help you set aside the basics of service-oriented systems through your first Apache Thrift-powered app. Then, progressing to more complex examples, it will provide you with tips for running large-scale applications in production environments. You will learn how to assess when Apache Thrift is the best tool to be used. To start with, you will run a simple example application, learning the framework's structure along the way; you will quickly advance to more complex systems that will help you solve various real-life problems. Moreover, you will be able to add a communication layer to every application written in one of the popular programming languages, with support for various data types and error handling. Further, you will learn how pre-eminent companies use Apache Thrift in their popular applications. This book is a great starting point if you want to use one of the best tools available to develop cross-language applications in service-oriented architectures.
Table of Contents (15 chapters)
Learning Apache Thrift
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
5
Generating and Running Code in Different Languages
Index

A technical overview of the application


As we now know what we want to achieve, this is the best time to plan the technical elements of Apache Thrift that we would want to use. This is still not the moment when we start coding; the effect of our work will be in pseudocode.

Note

Pseudocode is an informal description of how a computer program or other algorithm works or will work. This code doesn't have to be parsable in any programming language and the syntax relies heavily on convention. The goal of pseudocode is to give the developer an idea of what should be coded in the intended programming language without going deep into the implementation details.

As the core of every service is its functions, we will start from them, and then draw the big picture.

get_distance

Let's start with the first function of our service, get_distance. This function will return an integer value, which will be the distance in kilometers between two given points. As the maximal circumference of Earth is just a little...