# KafkaProject
A lightweight, distributed messaging application built with Java and Apache Kafka, featuring decoupled event production and consumption through two independent microservices.
## ποΈ Architecture
* **ProducerService**: Publishes events/messages to a designated Apache Kafka topic.
* **ConsumerService**: Subscribes to the Kafka topic and processes incoming messages in real-time.
---
## π οΈ Prerequisites
* **Java JDK 17+**
* **Apache Maven**
* **Apache Kafka** (running locally or via Docker)
---
## π Quick Start
### 1. Start Kafka Broker
If you use Docker, spin up Kafka quickly:
```yaml
version: '3'
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
environment:
ZOOKEEPER_CLIENT_PORT: 2181
kafka:
image: confluentinc/cp-kafka:latest
depends_on: [zookeeper]
ports:
- "9092:9092"
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
Open two separate terminals and execute the following commands:
cd ProducerService
mvn clean install && mvn spring-boot:run
cd ConsumerService
mvn clean install && mvn spring-boot:run
KafkaProject/
βββ ProducerService/ # Kafka Message Producer
βββ ConsumerService/ # Kafka Message Consumer
βββ README.md