= Avro Jackson DataFormat
:doctitle: Avro Jackson
:shortname: avroJackson
:artifactid: camel-jackson-avro
:description: Marshal POJOs to Avro and back using Jackson.
:since: 3.10
:supportlevel: Stable
//Manually maintained attributes
:camel-spring-boot-name: jackson-avro

*Since Camel {since}*

Jackson Avro is a Data Format which uses the
https://github.com/FasterXML/jackson/[Jackson library] with the https://github.com/FasterXML/jackson-dataformats-binary[Avro extension]
to unmarshal an Avro payload into Java objects or to marshal Java objects
into an Avro payload.

[TIP]
====
If you are familiar with Jackson, this Avro data format behaves in the
same way as its JSON counterpart, and thus can be used with classes
annotated for JSON serialization/deserialization.
====

[source,java]
-------------------------------
from("kafka:topic").
  unmarshal().avro(AvroLibrary.Jackson, JsonNode.class).
  to("log:info");
-------------------------------

== Configuring the SchemaResolver

Since Avro serialization is schema-based, this data format requires that you provide a SchemaResolver object
that is able to lookup the schema for each exchange that is going to be marshalled/unmarshalled.

You can add a single SchemaResolver to the registry and it will be looked up automatically.
Or you can explicitly specify the reference to a custom SchemaResolver.

== Avro Jackson Options

// dataformat options: START
include::partial$dataformat-options.adoc[]
// dataformat options: END


== Using custom AvroMapper

You can configure `JacksonAvroDataFormat` to use a custom `AvroMapper` in case you need more control of the mapping configuration.

If you setup a single `AvroMapper` in the registry, then Camel will automatic lookup and use this `AvroMapper`.

== Dependencies

To use Avro Jackson in your camel routes you need to add the dependency
on *camel-jackson-avro* which implements this data format.

If you use maven you could just add the following to your pom.xml,
substituting the version number for the latest & greatest release (see
the download page for the latest versions).

[source,xml]
----------------------------------------------------------
<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-jackson-avro</artifactId>
  <version>x.x.x</version>
  <!-- use the same version as your Camel core version -->
</dependency>
----------------------------------------------------------

include::spring-boot:partial$starter.adoc[]
