Skip to content

Python and Node applications for a simple example using Apache Kafka

Notifications You must be signed in to change notification settings

robsonalvz/kafka-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Getting started

Python and Node applications for a simple example using Apache Kafka

Installation

Please check the official Apache Kafka installation guide before you start. Official Documentation

Requirements

For building and running the application you need:

Clone the repository

git clone https://github.com/confluentinc/cp-docker-images

Switch to the repo folder

cd cp-docker-images/examples/kafka-single-node

Setting up docker-compose.yml

docker-compose up -d

Looking at the logs you can verify if that services are working as expected

docker-compose ps
docker-compose logs zookeeper | grep -i binding
docker-compose logs kafka | grep -i started

Generate afka-python-topic topic on Kafka

docker-compose exec kafka  \
kafka-topics --create --topic kafka-python-topic --partitions 1 --replication-factor 1 --if-not-exists --zookeeper zookeeper:2181

Install node modules in consumer application

yarn install

Install python modules in producer application

sudo pip install -r requirements.txt

Start the local producer server

python producer.py

You can now access consumers, open each of consumers in different terminals

node consumer-avg.js
node consumer-sum.js

About

Python and Node applications for a simple example using Apache Kafka

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published