An attempt to implement a popular design question asked in various interviews.
git clone https://github.com/vivekkothari/game-leaderboard.git
cd game-leaderboard
docker compose up -d
Then run src/main/java/com/github/vivekkothari/Main.java file
This will start,
- server accepting request of game completion.
- a kafka producer
- a kafka consumer
You can simulate game completion events by running the following command in a separate terminal:
./simulate_game_play.sh 10000 1 100 the first arg is num of events, second is from userId, last is to userId.
You can view the top k players by running the following command in a separate terminal:
curl -X GET "http://localhost:4040/top-scores?limit=10"