Skip to content

A React, Typescript app that uses socket.io to communicate with a Node.js, Kafka consumer backend. The Textual python app sends info via a post request to a go gin kafka producer backend. The docker compose sets up the Kafka.

Notifications You must be signed in to change notification settings

ProgrammerSteve/kafkaDemo

Repository files navigation

Geting Started

  • use docker compose to set up kafka and zookeeper
  • run docker exec -it kafka /bin/sh to access the kafka container
  • get to the folders with the commands cd ./opt/kafka/bin
  • create a topic called messages if not already present

Kafka Related Commands

Enter kafka

docker exec -it kafka /bin/sh

Create a kafka topic

kafka-topics.sh --create --zookeeper zookeeper:2181 --replication-factor 1 --partitions 1 --topic dummy_topic

List kafka topics

kafka-topics.sh --list --zookeeper zookeeper:2181

Describe a kafka topic

kafka-topics.sh --describe --zookeeper zookeeper:2181 --topic dummy_topic

Delete a kafka topic

kafka-topics.sh --delete --zookeeper zookeeper:2181 --topic dummy_topic

Send Message on Producer

kafka-console-producer.sh --broker-list kafka:9092 --topic messages

{'user_id':1,'recipient_id':2,'message':'Hi.'} {'user_id':2,'recipient_id':1,'message':'Hey.'}

[ctrl]+c to exit

Listen for Messages on Consumer

kafka-console-consumer.sh --bootstrap-server kafka:9092 --topic messages

Listen for Messages on Consumer, list all previous

kafka-console-consumer.sh --bootstrap-server kafka:9092 --topic messages --from-beginning

Textual TUI

  • A python application made with the textual framework
  • Text User Interface (TUI)
  • https://textual.textualize.io/
  • sends information to the go backend to be relayed to kafka

Python Textual Kafka App

React Real-time Display

React Real-Time Kafka App

Consumer Node Server

  • connects to kafka on localhost:9091 on the 'messages' topic
  • uses socket.io to communicate with the react frontend
  • acts as a consumer for kafka

Producer Go Server

  • uses the gin framework to set up endpoints
  • connect to kafka on localhost:9091 on the 'messages' topic
  • acts as a producer for kafka

About

A React, Typescript app that uses socket.io to communicate with a Node.js, Kafka consumer backend. The Textual python app sends info via a post request to a go gin kafka producer backend. The docker compose sets up the Kafka.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published