This exercise application implements a small system to count the results of the Eurovision Song Contest.
-
An OpenAPI specification designed to provide Api Design First approach.
-
Vert.x Web API Contract used to expose endpoint paths and validate them with OpenAPI spec.
-
An HTTP Server expose an endpoint with relevant paths alligned with OpenAPI spec and controlled by Web API Contract.
-
Endpoint paths connected to HTTP Server router built with OpenAPI directly to EventBus services.
-
An EventBus allowed many parts of application to communicate each other.
-
Reactive pattern implemented to develop transaction services, mainly RxJava2, asychronous and Java streams.
-
Two verticles developed: a vote transaction services verticle(Java) and a metrics reporter(Kotlin)
-
Thanks to Vert.x polyglot support Java and Kotlin used with verticle developments
-
A metric reporter designed to push metrics to the eventbus topic
-
A dashboard designed to check vote result through a webscoket and read latest vote result metrics from the eventbus topic
-
Reactive and non blocking PostgreSQL client used to handle database connections, queries and transactions.
-
Application dockerized from adoptopenjdk/openjdk8-openj9:alpine-jre image.
-
A PostgreSQL database preffered to store application data through reactive database driver. During installation all required database, schema, table and indexes are created.
-
Application and database docker containers composed and run with Docker Compose.
To compose and run your application:
docker-compose up --build
Note
|
Docker composes and runs an application container and a database container |
To stop application and db containers:
docker-compose down -v
Post a vote with curl
:
curl -X POST "http://localhost:8888/votes/2020" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"countryFrom\":\"Netherlands\",\"votedFor\":\"Belgium\"}"
Get top three countries for the specified year
curl -X GET "http://localhost:8888/votes/2020" -H "accept: application/json"
Get the top three favorite songs for the specified year and country
curl -X GET "http://localhost:8888/votes/2020/Netherlands" -H "accept: application/json"
To check online results launch Vote Results Dashboard at http://localhost:9999/