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 c8161a3 Camel-Kafka added a sample of multiple topics consumer in docs c8161a3 is described below commit c8161a3966493e675d9a92686908bf715340c298 Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Mon Jun 11 07:36:55 2018 +0200 Camel-Kafka added a sample of multiple topics consumer in docs --- components/camel-kafka/src/main/docs/kafka-component.adoc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/components/camel-kafka/src/main/docs/kafka-component.adoc b/components/camel-kafka/src/main/docs/kafka-component.adoc index 13244b7..6f0fb08 100644 --- a/components/camel-kafka/src/main/docs/kafka-component.adoc +++ b/components/camel-kafka/src/main/docs/kafka-component.adoc @@ -218,6 +218,7 @@ After the message is sent to Kafka, the following headers are available ==== Consuming messages from Kafka Here is the minimal route you need in order to read messages from Kafka. + [source,java] ---- from("kafka:test?brokers=localhost:9092") @@ -228,6 +229,18 @@ from("kafka:test?brokers=localhost:9092") .log(" with the key ${headers[kafka.KEY]}") ---- +If you need to consume messages from multiple topics you can use a comma separated list of topic names + +[source,java] +---- +from("kafka:test,test1,test2?brokers=localhost:9092") + .log("Message received from Kafka : ${body}") + .log(" on the topic ${headers[kafka.TOPIC]}") + .log(" on the partition ${headers[kafka.PARTITION]}") + .log(" with the offset ${headers[kafka.OFFSET]}") + .log(" with the key ${headers[kafka.KEY]}") +---- + When consuming messages from Kafka you can use your own offset management and not delegate this management to Kafka. In order to keep the offsets the component needs a `StateRepository` implementation such as `FileStateRepository`. This bean should be available in the registry. -- To stop receiving notification emails like this one, please contact acosent...@apache.org.