Task 2 - Apache Thrift

This task is about cross-language communication using remote procedure calls (RPC), using Apache Thrift. Implement a simple client-server application which will use given a communication protocol, and will be implemented in different programming languages. The protocol is based on a given language-independent interface description in Thrift IDL. Then, extend the protocol while maintaining full run-time compatibility.


The task requires understanding of the following:


The application that will be implemented is themed around a search service for a library. It is however designed to primarily show working with various data types using cross-language RPC, rather than perform any meaningful task.

The main idea is that the client logs in to the server, then lets the server perform a search for some library items (books, CDs or magazines). The result of the search is a list of items, which are returned to the client one by one. The client generates a summary based on the items and saves it on the server, which checks correctness of the summary.

Because the focus of this task is just the communication not an actual functionality of the application, we will work with just random data without any meaning.


The client and server should communicate like this:

  1. The client logs in
  2. Searching for items
  3. Creating a summary
  4. The client logs out

Your tasks are

1. Implement the Client

Implement a client which will communicate with the server using the protocol defined by the IDL file and the description above.

Connect to Server

Test that the client works with our server at lab.d3s.mff.cuni.cz:5001.

2. Implement the Server

Implement the server side of the application in C++.

3. Protocol update

An important feature of Thrift and its IDL is the ability to evolve the interface while keeping compatibility. For example, new fields can be added to user-defined types, fields which are not required may be removed, function parameters may be added, etc.

The client and server may use different definition of a type or a function.

New features

  1. Extend the interface with new types of an items (CD, Magazine) in addition to Book.
  2. Modify the Search service in some way to allow the client to initiate a search, specifying:
  3. Modify the Search service in some way to allow fetching multiple items at once.
  4. Update the implementation of the server to support these new features.
  5. Update the implementation of the client to support these new features.