This repository aims to create a worker pool model for any Message Broker, having a monorepo structure and using docker-compose to create and configure both RabbitMQ and Kafka. Future plans includes SQS and Redis with some proper configuration.
I create this just play a little with Kotlin/Quarkus, had to practice my frontend... And what better to do them to build a whole application from it hahaha...
- Golang
- Kotlin + Quarkus
- Next.js
- RabbitMQ / Kafka
- Docker & Docker Compose
The system is composed of three main parts:
- Frontend - Next.js
- Producer - Kotlin + Quarkus
- Worker Pool - Golang
Communication is asynchronous and mediated by a Message Broker, RabbitMQ and/or Apache Kafka.
- The user interacts with the Next.js UI
- The UI sends an HTTP request to the Kotlin/Quarkus Producer
- The Producer:
- Parses the request
- Generates
NUser CRUD messages (based on user input) - Publishes messages to the selected broker (RabbitMQ or Kafka)
- The Golang Worker Pool:
- Consumes messages from the broker
- Processes them concurrently
- Enforces a strict concurrency limit via
GOMAXPROCS
The frontend is intentionally minimal.
Components:
-
Two buttons:
RabbitMQApache Kafka
-
An input field to define how many messages should be produced
-
And three buttons to define what action should be done:
- DELETE x
Users - CREATE x
Users - UPDATE x
Users
- DELETE x
-
Details Screen:
- A minimal box with all the user data with
offset pagination.
- A minimal box with all the user data with
Behavior:
- Clicking a button sends a request to the Producer API
- The selected broker is inferred from the URL
- No direct communication with the Go workers
backend/
├── producer/
│ ├── quarkus-app/
│ │ ├── src/
│ │ └── ...
│ └── README.md
│
├── worker/
│ ├── cmd/
│ ├── internal/
│ │ ├── worker/
│ │ ├── broker/
│ │ │ ├── kafka/
│ │ │ └── rabbitmq/
│ │ └── config/
│ ├── go.mod
│ └── README.md
frontend/
├── app/
├── components/
├── services/
└── README.md
- Simple UI
- No business logic
- Acts only as a trigger layer
For questions or help, contact: rafael.cr.carneiro@gmail.com