THINGS ADDED TO SCALE UP:
ADD MULTIPLE BROKERS TO THE CLUSTER
This is a simple HTTP server built with Go and Fiber that interacts with Apache Kafka to add and retrieve tasks.
- Go
- Fiber
- Sarama
- Install Go: https://golang.org/doc/install
- Install Fiber:
go get -u github.com/gofiber/fiber/v2 - Install Sarama:
go get -u github.com/IBM/sarama
- Start a Kafka broker on
localhost:9092. - Run the server:
go run main.go. - Use a POST request to add a task:
curl -X POST -d '{"id": 1}' http://localhost:3000/task. - Use a GET request to retrieve a task:
curl http://localhost:3000/task.
- Kafka broker address: Modify the
brokervariable inmain.goto point to your Kafka broker.
- URL:
/task - Method: POST
- Request Body:
{ "id": 1 }