Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (21 sloc) 926 Bytes


Simple example for reading and writing into Kafka

Set up Kafka

#get kafka
# unpack
tar xf kafka_2.10-
cd kafka_2.10-

# start zookeeper server
./bin/ ./config/

# start broker
./bin/ ./config/ 

# create topic “test”
 ./bin/ --create --topic test --zookeeper localhost:2181 --partitions 1 --replication-factor 1

# consume from the topic using the console producer
./bin/ --topic test --zookeeper localhost:2181

# produce something into the topic (write something and hit enter)
./bin/ --topic test --broker-list localhost:9092

Watch this YouTube video to see how this code is working with Kafka: