https://github.com/edgar-code-repository/avro-library-generator
Generating a Jar file from an Avro schema.
https://github.com/edgar-code-repository/avro-library-generator
Last synced: 6 months ago
JSON representation
Generating a Jar file from an Avro schema.
- Host: GitHub
- URL: https://github.com/edgar-code-repository/avro-library-generator
- Owner: edgar-code-repository
- Created: 2023-01-28T05:36:32.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-02-03T20:27:46.000Z (over 3 years ago)
- Last Synced: 2025-01-23T04:29:34.184Z (over 1 year ago)
- Size: 93.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
AVRO LIBRARY GENERATOR
-----------------------------------------------------------------
Application that generates a Jar file from an Avro schema.
The JAR file generated will be used by consumers/producers
to serialize/deserialize Avro messages from Kafka.
-----------------------------------------------------------------
An Avro schema was generated in this project:
https://github.com/edgar-code-repository/avro-schema-generator
```
{
"type" : "record",
"name" : "AvroMessageDTO",
"namespace" : "com.domain.example.dto",
"fields" : [
{ "name" : "code", "type" : "int" },
{ "name" : "message", "type" : "string" },
{ "name" : "description", "type" : [ "null", "string" ], "default" : null }
]
}
```
-----------------------------------------------------------------
In order to generate the Jar, a plugin and
a dependency are needed in the build.gradle file.
Plugins:
```
id "com.commercehub.gradle.plugin.avro" version "0.9.0"
```
Dependencies:
```
compile "org.apache.avro:avro:1.8.2"
```
The plugin searches for Avro schemas in folders named "avro" in
every source set.
In this case the schema file is located in the directory src/main/avro.
-----------------------------------------------------------------
When the build gradle task is executed, the Jar file
appears in the build/libs directory:

-----------------------------------------------------------------