Search⌘ K
AI Features

Avro: IDL & RPC

Explore how Avro's Interface Definition Language (IDL) simplifies schema definition and enables remote procedure calls (RPC). Learn schema generation, auto-code creation, and the proxy pattern that supports secure and efficient method invocation across distributed systems.

Avro IDL & RPC

Other serialization formats such as Thrift, Protocol Buffers, and others provide an Interface Definition Language(IDL). IDL allows the user to express a schema similar to you can write code in a programming language, rather than using JSON to specify the schema. Avro offers an equivalent: Avro IDL.

The Avro IDL comes with its own rules and syntax. It appear similar to popular languages like Java, C++, and Python. We’ll present a simple example demonstrating the use of IDL. More details can be found here. Each Avro IDL file defines a single Avro Protocol. When compiled, the output is a JSON format Avro Protocol file with extension .avpr. We can represent a car record in IDL format as follows:

/**
 * Car schema expressed in Avro IDL as a protocol
 */
@namespace("io.datajek")
protocol CarProtocol {

  record Car {
    string make;
    string model;
    int year;
    int horsepower;
  }

string carToString(Car car);
}

Once we define the .avdl file, we can convert it into an .avpr file like this:

 ...