Scoring Service, baked with Quarkus and Infinispan
Run Infinispan with Docker
docker run -v $(pwd):/user-config -p 11222:11222 -e USER="admin" -e PASS="pass" infinispan/server:12.0.1.Final
Health : http GET http://localhost:8080/scoring
POST /scoring/{gameId}}/{matchId}/{userId}?delta={delta}&username={username}&human={human}×tamp={timestamp}&bonus={bonus}
gameId
: Generation or id gamematchId
: the match iduserId
: player id that is scoringusername
: the player name, " " encoded as %20delta
: increment of the scorehuman
:true
for humans,false
for AItimestamp
: long milliseconds numberbonus
:true
for bonus scoring
Example:
http POST 'http://localhost:8080/scoring/g1/m1/u1?delta=123&username=pepe%20coco&human=true×tamp=9090898'
GET /scoring/{gameId}/{matchId}/{userId}/score
gameId
: Generation or id gamematchId
: the match iduserId
: player id that is scoring
Example:
http GET 'http://localhost:8080/scoring/g1/m1/u1/score'
GET /scoring/{gameId}/ranking?max={max}
gameId
: Generation or id gamemax
: max results, default 1000
POST /scoring/{gameId}/{matchId}/{userId}/win?timestamp={timestamp}
gameId
: Generation or id gamematchId
: the match iduserId
: player id that has won the matchtimestamp
: long milliseconds number
Example:
http POST 'http://localhost:8080/scoring/{gameId}/{matchId}/{userId}/win?timestamp=1223'
POST /scoring/{gameId}/{matchId}/{userId}/loss?timestamp={timestamp}
gameId
: Generation or id gamematchId
: the match iduserId
: player id that has lost the matchtimestamp
: long milliseconds number
http POST 'http://localhost:8080/scoring/g1/m1/u1/loss?timestamp=1223'
POST /shot/{gameId}/{matchId}/{userId}/{timestamp}?type={type}&ship={ship}&human={human}
gameId
: Generation or id gamematchId
: the match iduserId
: player id that has performed a shot in the matchtimestamp
: long milliseconds numbertype
: shot type:HIT
,MISS
orSUNK
ship
: optional parameter. ship typeCARRIER
,SUBMARINE
,BATTLESHIP
,DESTROYER
human
:true
for humans,false
for AI
http POST 'http://localhost:8080/shot/g1/m1/u1/10?type=MISS&ship=&human=true'
http POST 'http://localhost:8080/shot/g1/m1/u1/11?type=HIT&ship=CARRIER&human=true'
http POST 'http://localhost:8080/shot/g1/m1/u1/12?type=SUNK&ship=CARRIER&human=true'
- Run Infinispan
./run-infinispan.sh
-
Build following the instructions the native or the jvm image (instructions in Dockerfile or Dockerfile.jvm)
-
Run the application
TIP: Use env variable SCORING_CONFIGURE_INFINISPAN=true
to create caches
./run-app.sh
Access
- Scoring:
http://localhost:8080
docker commit a358deaa1504 quay.io/redhatdemo/2021-scoring-service
docker push quay.io/redhatdemo/2021-scoring-service