This project demonstrates how to build a Kafka-based order processing system using Golang. It includes a producer, a consumer, and additional components to handle coffee orders efficiently.
The project simulates a coffee shop's order management using Apache Kafka for message queuing and Go for implementation.
- Producer:
- Accepts orders via a REST API.
- Sends orders as messages to a Kafka topic.
- Consumer:
- Listens to the Kafka topic.
- Processes incoming coffee orders.
- Go (1.18+ recommended)
- Apache Kafka setup on
localhost:9092
- Git installed
-
Clone the repository:
git clone https://github.com/ArjunDev17/brewline-backend cd kafka-coffee-order-system
-
Switch to your desired branch:
git branch git checkout <branch-name>
- Available branches:
main
: Main system setup.producer
: Contains producer code.consumers
: Contains consumer code.addtional_theory
: Extra resources and notes.
- Available branches:
-
Install dependencies:
go mod tidy
Run the producer to accept coffee orders via a REST API:
go run producer.go
- Endpoint:
POST http://localhost:3000/order
- Example request:
{ "customerName": "Kabir Singh", "coffeeType": "Milkyy" }
Run the consumer to process coffee orders:
go run consumer.go
- The consumer listens to the topic
coffee_orders
and logs processed orders.
main
: Core system.producer
: REST API for sending orders to Kafka.consumers
: Processes messages from Kafka.addtional_theory
: Notes or extra material for deeper learning.
Feel free to submit issues or pull requests. Your contributions are welcome!