https://github.com/fenil3357/kafkajs-demo
A simple demo project to understand the working of kafka with expressjs using kafkajs.
https://github.com/fenil3357/kafkajs-demo
express kafdrop kafka kafkajs
Last synced: 7 months ago
JSON representation
A simple demo project to understand the working of kafka with expressjs using kafkajs.
- Host: GitHub
- URL: https://github.com/fenil3357/kafkajs-demo
- Owner: fenil3357
- Created: 2024-11-14T06:06:10.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-11-14T13:06:37.000Z (11 months ago)
- Last Synced: 2025-01-25T16:15:13.678Z (9 months ago)
- Topics: express, kafdrop, kafka, kafkajs
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# kafkajs-demo
## Overview
It is a simple demo project to understand the working of kafka with express servers. I have used *kafkajs* as a kafka client for nodejs and *kafdrop* to monitor kafka service.
## Set up
1) Clone the repo and install the deps.
```
git clone https://github.com/fenil3357/kafkajs-demo.git
cd kafkajs-democd payment-service
npm icd user-service
npm i
```2) Run the zookeeper, kafka and kafdrop using docker compose.
```
cd kafka
docker compose up
```3) Once it is running run the *admin.js* file which will create *payment-topic* with two partitions
```
cd kafka
node admin.js
```4) After creating the topic run the payment and user services
```
cd payment-service
npm startcd user-service
npm start
```5) Now trigger the api in payment service to see result
```
curl "http://localhost:3000/proceed-payment?sender=Paul&receiver=Sam&amount=1000"
```You can see the event listened in the user service console. You can also monitor kafka through kafkdrop on port 9000.
```
# Kafka monitor
http://localhost:9000
```