blob: 96da894b3ecfb5d19af746768fc2bb0ff0a1fbd5 [file] [log] [blame]
= Camel Kafka example
=== Introduction
An example which shows how to integrate Camel with Kafka offsetRepository(consumer) to use in order to locally store the offset of each partition of the topic
This project consists of the following examples:
1. Producer triggers with a timer and produces messages to the configured topic partition
2. Consumer consumes from configured topic by reading the offset value from locally stored file.
=== Preparing Kafka
This example requires that Kafka Server is up and running.
$ ${KAFKA}/bin/ ${KAFKA}/config/
$ ${KAFKA}/bin/ ${KAFKA}/config/
You will need to create following topics before you run the examples.
On windows run
$ ${KAFKA}/bin/kafka-topics.bat --create --zookeeper <zookeeper host ip>:<port> --replication-factor 1 --partitions 1 --topic my-topic
On linux run
$ ${KAFKA}/bin/ --create --zookeeper <zookeeper host ip>:<port> --replication-factor 1 --partitions 1 --topic my-topic
=== Build
You will need to compile this example first:
$ mvn compile
=== Run
Run the consumer first in separate shell
$ mvn spring-boot:run
camel-context.xml file has both kafka-producer and kafka-consumer routes defined to produce/consume messages to topic my-topic.
Press `Ctrl-C` to exit.
=== Configuration
You can configure the details in the file:
You can enable verbose logging by adjusting the `src/main/resources/`
file as documented in the file.
=== Forum, Help, etc
If you hit an problems please let us know on the Camel Forums
Please help us make Apache Camel better - we appreciate any feedback you may
have. Enjoy!
The Camel riders!