Kafka Client is a Node.js application written in TypeScript that demonstrates how to use Apache Kafka while adhering to SOLID principles.
Follow these instructions to set up and run the Kafka Client Node.js TypeScript app.
To run this application, you need to have Apache Kafka installed and running on your machine. You can download and install Kafka from the official website: Apache Kafka.
- Clone the repository:
git clone <repository_url>
- Navigate to the project directory:
cd kafka-client
- Install the dependencies:
npm install
Before running the app, make sure to update the Kafka configuration in src/kafkaConfig.ts
with your Kafka broker details:
// src/kafkaConfig.ts
export const kafkaConfig = {
brokers :["localhost:9092"], // Replace with your Kafka broker(s) information
topic: "test-topic", // Replace with your Kafka topic name
clientId:"kafka-client" // Replace with your Kafka client ID
};
To start the application, run the following command:
npm start
This will start the Kafka producer and consumer, demonstrating the interaction between the two.
- Kafka Producer: Sends messages to a Kafka topic.
- Kafka Consumer: Receives messages from the same Kafka topic.
This project is licensed under the MIT License - see the LICENSE file for details.
This project was created for educational purposes and follows the SOLID principles to demonstrate how to use Kafka with Node.js and TypeScript. Feel free to use and modify it as needed.