GitHunt
HA

HalilOzkan/eurovision-song-contest

A sample implementation to count the results of the Eurovision Song Contest

= Eurovision-song-contest
:icons: font

image:https://img.shields.io/badge/vert.x-3.9.1-purple.svg[link="https://vertx.io"]

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.

== Prerequisites

  • JDK 8+
  • Docker Engine
  • Docker Compose

== Building

To package your application:

./gradlew clean build -x test

== Run

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

== Getting Started
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/

== Help

Languages

Java61.7%JavaScript26.0%Kotlin6.4%HTML3.0%Dockerfile1.5%TSQL1.4%

Contributors

Apache License 2.0
Created May 25, 2020
Updated June 4, 2020