This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new a09de9c Add Consuming Avro messages from Kafka using the schema-registry example to Kafka component docs a09de9c is described below commit a09de9cb2edb95411323e98a23f8e9a939d3c11a Author: Peter Palaga <ppal...@redhat.com> AuthorDate: Wed Dec 23 16:27:32 2020 +0100 Add Consuming Avro messages from Kafka using the schema-registry example to Kafka component docs --- .../apache/camel/catalog/docs/kafka-component.adoc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/kafka-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/kafka-component.adoc index 9543557..fa17fc0 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/kafka-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/kafka-component.adoc @@ -378,7 +378,7 @@ camelContext.addRoutes(new RouteBuilder() { } }); ---- - + === Producing messages to Kafka @@ -580,3 +580,22 @@ from("kafka:my_topic?headerFilterStrategy=#myStrategy") `myStrategy` object should be subclass of `HeaderFilterStrategy` and must be placed in the Camel registry, either manually or by registration as a bean in Spring/Blueprint, as it is `CamelContext` aware. include::camel-spring-boot::page$kafka-starter.adoc[] + +== Consuming Avro messages from Kafka using the schema-registry +*Since Camel 3.0.0* + +This route applies the schema and converts the Avro messages to POJOs for further processing: + +[source,java] +---- +from(kafka("avro-events") + .brokers("localhost:9092") + .schemaRegistryURL("http://localhost:8081") + .specificAvroReader(true) + .valueDeserializer("io.confluent.kafka.serializers.KafkaAvroDeserializer") + .log("Avro Message: ${body}") +---- + +For this to work, you need to use `avro-maven-plugin` to generate the Java sources of your POJOs from your schema +files. Put your `.avsc` files in the `src/main/avro` directory of your project where the plugin looks for them +by default. \ No newline at end of file