docker compose up -d
go get github.com/IBM/sarama github.com/gin-gonic/gin
go run cmd/producer/producer.go
go run cmd/consumer/consumer.go
With both producer and consumer running, you can simulate sending notifications. Open up a third terminal and use the below curl commands to send notifications:
curl -X POST http://localhost:8080/send \
-d "fromID=2&toID=1&message=Bruno started following you."
curl -X POST http://localhost:8080/send \
-d "fromID=1&toID=2&message=Emma mentioned you in a comment: 'Great seeing you yesterday, @Bruno!'"
curl -X POST http://localhost:8080/send \
-d "fromID=4&toID=1&message=Lena liked your post: 'My weekend getaway!'"
Finally, you can fetch the notifications of a specific user. You can use the below curl commands to fetch notifications:
curl http://localhost:8081/notifications/1