Apache Kafka Examples for getting Started
Java
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
kafka-flink
kafka-spring
LICENSE
README.md

README.md

Download

Apache kafka examples

Getting Started

See http://kafka.apache.org/documentation.html#quickstart

You can either use the Dockerfile (plus provisioning scripts) here https://github.com/wurstmeister/kafka-docker or follow the steps below

Step 1: Download Binary and unpack

wget http://apache.mirror.anlx.net/kafka/0.10.0.1/kafka_2.11-0.10.0.1.tgz
tar -xzf kafka_2.11-0.10.0.1.tgz
cd kafka_2.11-0.10.0.1

Note: Swap versions with latest in above snippet if you require

Step 2: Quick and Dirty method to get up and running

If running on windows run the same commands from <KARKA_HOME>bin/windows and use .bat extensions

Start zookeeper followed by Kafka Broker

bin/zookeeper-server-start.sh config/zookeeper.properties
bin/kafka-server-start.sh config/server.properties
## Or for even more fun, Start Multiple Kafka Brokers with different config/server.properties

Step 3: Create a Test Topic using cli tools

bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

And list topic

bin/kafka-topics.sh --list --zookeeper localhost:2181

Output:

test

Step 4: Send Some messgaes with cli

bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
This is a message
This is another message

Step 5: Start a consumer

bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning

Output:

This is a message

This is another message