Simple broadcaster of updates of covid-19 stats by country/continent using RabbitMq and Spring AMQP. There are 2 spring boot applications, the sender broadcasts updates and there could be N number of consumers subscribed to those updates based on the continent or country that are listening.
In the sender application, there's a controller to publish updates. Set country (Alpha-3) and continent (Alpha-2) names using these codes: https://www.iban.com/country-codes and https://datahub.io/core/continent-codes/r/0.html
[POST] http://localhost:8080/samplecovid19/update/create
Body:
{
"continent": "CR" ,
"countryName": "CRI" ,
"cases": 435 ,
"deaths": 2 ,
"recovered": 13
}
Updates will be printed on receivers console
-
Run docker dependencies: docker-compose up -d
-
Run the sender application: ./gradlew sender:bootrun
-
Run receivers setting different ports, continents and countries parameters:
Listen updates of Central America
./gradlew receiver:bootrun -Pargs=--server.port=8081,--topic.continent=CAListen updates of Costa Rica
./gradlew receiver:bootrun -Pargs=--server.port=8082,--topic.continent=CA,--topic.country=CRCListen updates of North America
./gradlew receiver:bootrun -Pargs=--server.port=8083,--topic.continent=NAListen updates of United States
./gradlew receiver:bootrun -Pargs=--server.port=8084,--topic.continent=NA,--topic.country=USAListen updates of South America
./gradlew receiver:bootrun -Pargs=--server.port=8085,--topic.continent=SAListen updates of Brazil
./gradlew receiver:bootrun -Pargs=--server.port=8086,--topic.continent=SA,--topic.country=BRAListen updates of Europe
./gradlew receiver:bootrun -Pargs=--server.port=8087,--topic.continent=EUListen updates of Germany
./gradlew receiver:bootrun -Pargs=--server.port=8088,--topic.continent=EU,--topic.country=DEUListen updates of Italy
./gradlew receiver:bootrun -Pargs=--server.port=8089,--topic.continent=EU,--topic.country=ITAListen updates of Spain
./gradlew receiver:bootrun -Pargs=--server.port=8090,--topic.continent=EU,--topic.country=ESPListen updates of Asia
./gradlew receiver:bootrun -Pargs=--server.port=8091,--topic.continent=ASListen updates of China
./gradlew receiver:bootrun -Pargs=--server.port=8092,--topic.continent=AS,--topic.country=CHNListen updates of South Korea
./gradlew receiver:bootrun -Pargs=--server.port=8093,--topic.continent=AS,--topic.country=KOR