This project is a Dockerized FastAPI application designed for managing live cricket commentary. It consists of two separate FastAPI services:
- Publish Service: Publishes cricket commentary to a Kafka topic.
- Consume Service: Consumes and processes cricket commentary from the Kafka topic.
Both services are containerized using Docker and are configured to communicate with a Kafka broker running in a separate container. Zookeeper is also included as Kafka's dependency.
- Docker
- Docker Compose
git clone [https://github.com/your-repo/cricket-commentary-app.git](https://github.com/rahuladream/cricket-commentary-kafka)
cd cricket-commentary-app
Build the Docker images and start all the services using Docker Compose:
docker-compose build
docker-compose up
- Publish Service: Available at https://localhost:8001. Use this service to publish cricket commentary to Kafka.
- Consume Service: Available at https://localhost:8002. This service consumes commentary from Kafka
curl -X POST "https://localhost:8001/v1/publish_commentary/" -H "Content-Type: application/json" -d "{\"commentary\": \"Player X hits a six!\"}"
Make sure to have websocket connection this WebSocket-Chrome
curl "https://localhost:8002/ws/commentary/"