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. The protocol is based on a given language-independent interface description in Thrift IDL. Then, extend the protocol while maintaining full run-time compatibility.

Preparation

Download the input source code https://d3s.mff.cuni.cz/legacy/files/teaching/nswi080/labs/Files/sources-2.zip . Install Apache Thrift and try the example https://d3s.mff.cuni.cz/legacy/files/teaching/nswi080/labs/Files/lab-2thrift-en.html . We will use C++ to implement the server. Choose a different programming language supported by Thrift for implementing the client.

The task requires understanding of the following:

Application

The application that will be implemented does not perform any meaningful task, it is designed to merely show working with various data types using cross-language RPC.

The main idea is that the client logs in to the server, then lets the server perform a search for some items. 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.

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.

Communication

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 (ItemB, ItemC) in addition to ItemA. The C++ variants of these types are in items.hpp.
  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.

Instructions