You need to have docker installed and run
docker-compose up -d
It will serve a kafka ui dashboard in port 8080 http://localhost:8080/
The producer code is in the producer folder and serves a small scaffold that contains the configuration of the producer.
Inside the producer folder run npm install
Run the producer in dev mode npm run start:dev
The consumer code is in the consumer folder and serves a small scaffold that contains the configuration of the consumer.
Inside the consumer folder run npm install
Run the consumer in dev mode npm run start:dev
GET
to http://localhost:3000/kafka-test
to emit a JSON message to the topic.
GET
to http://localhost:3000/kafka-test-with-response
Please do not ever use hardcoded configuration in your projects. Use at least a .env
instead.
Reference Article