Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.
/ avro-scala-demo Public archive

Demonstration of using avro4s library in Scala to provide basic Avro serialization

Notifications You must be signed in to change notification settings

jpallari/avro-scala-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Avro Scala demo

Sample project using avro4s and sbt-avro4s for Apache Avro serialization.

Here's how it works

The Avro schema definitions are placed located in the classpath of the project. In this project, they're placed in the directory src/main/resources/avro/.

During the compilation phase, sbt-avro4s picks up the schema definitions, builds compatible Scala classes, and writes the classes to the managed source directory: target/scala-2.11/src_managed/

In the example Main program, the schema is read from the file in the classpath. This schema can be used for reading and writing binary data to generic Avro records.

During the program compilation, avro4s will automatically generate code for mapping the generic Avro records to the generated classes. This compile time code generation is done using Scala macros. avro4s can then use the generated code in combination with the previously read schema to read and write binary data to the generated classes. This way the mapping code is transparent to the user.

Running the demo

You have to have sbt installed. After you've installed sbt, run command:

sbt run

About

Demonstration of using avro4s library in Scala to provide basic Avro serialization

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages