Camel Quarkus

Avro

JVM since1.0.0 Native since1.0.0

Serialize and deserialize messages using Apache Avro binary data format

What’s inside

Please refer to the above link for usage and configuration details.

Maven coordinates

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-avro</artifactId>
</dependency>

Check the User guide for more information about writing Camel Quarkus applications.

Additional Camel Quarkus configuration

Beyond standard usages known from vanilla Camel, Camel Quarkus adds the possibility to parse the Avro schema at build time both in JVM and Native mode.

The approach to generate Avro classes from Avro schema files is the one coined by the quarkus-avro extension. It requires the following:

  1. Store *.avsc files in a folder named src/main/avro or src/test/avro

  2. In addition to the usual build goal of quarkus-maven-plugin, add the generate-code goal:

    <plugin>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-maven-plugin</artifactId>
        <executions>
            <execution>
                <id>generate-code-and-build</id>
                <goals>
                    <goal>generate-code</goal>
                    <goal>build</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

Please see a working configuration in Camel Quarkus Avro integration test and Quarkus Avro integration test.

Trusted classes

Since Avro 1.12.2, SpecificData refuses to load classes that are not explicitly trusted, failing with:

java.lang.SecurityException: Forbidden com.acme.MyRecord! This class is not trusted to be included in Avro schemas.

Classes annotated with @org.apache.avro.specific.AvroGenerated are trusted automatically, which covers everything produced by the generate-code goal described above. Specific records that predate that annotation, or that were written by hand, have to be trusted explicitly:

quarkus.avro.trusted-classes=com.acme.MyRecord
quarkus.avro.trusted-packages=com.acme.avro