Apache Kafka Integration with Apache Beam
STEP 1: GET KAFKA
-
Download the latest Kafka release and extract it:
-
$ tar -xzf kafka_2.13-3.2.0.tgz
-
$ cd kafka_2.13-3.2.0
NOTE: Your local environment must have Java 8+ installed.
Run the following commands in order to start all services in the correct order:
$ bin/zookeeper-server-start.sh config/zookeeper.properties
- Open another terminal session and run:
$ bin/kafka-server-start.sh config/server.properties
- Once all services have successfully launched, you will have a basic Kafka environment running and ready to use.
$ bin/kafka-topics.sh --create --topic <tpoic_name> --bootstrap-server localhost:9092
Run the following command to start a Kafka Producer, using console interface, writing to sampleTopic.
$ bin/kafka-console-producer.sh --broker-list localhost:9092 --topic new_topic
Run the following command to start a Kafka Consumer, using console interface, subscribed to sampleTopic.
$ bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic new_topic --from-beginning
- To build the service: Open the
Kafka-Integration-With-Apache-Beam
- folder in terminal and run
mvn clean install
. - To run the test cases: run
mvn clean test
.