/learn-java-avro

A quick tutorial on Apache Avro, a data serialization system.

Primary LanguageJava

Learn Apache Avro (Java)

The official doc states that Apache Avro is a data serialization system. With schemas defined in JSON, Avro facilitates language agnostic usage and implementations, since data together with the schema are self-describing.

Avro provides:

  • Rich data structures
  • A compact, fast, binary data format
  • A container file, to store persistent data
  • Remote procedure call (RPC)
  • Simple integration with dynamic languages (Code generation is not required to read or write data files nor to use or implement RPC protocols)

In this project, the serialization/deserialization and RPC examples listed on its Getting Started page are gone through for a quick initial understanding of this library.

Serialization & Deserialization

Both specific data serialization with code generation and generic data serialization without code generation are presented.

Remote Procedure Call

An RPC is an inter-process communication technique used for client-server based applications. RPC based APIs are great for actions (procedures or commands etc.) and REST based APIs are great at modeling the domain (resources or entities) and making CRUD operations. The example here demonstrates how a client makes an RPC call to ask the server to send a message.

Build & Run

mvn compile
mvn -e exec:java -Dexec.mainClass=com.flyer.avro.rpc.AvroRPCDemo
mvn -e exec:java -Dexec.mainClass=com.flyer.avro.serdes.AvroSerDesDemo