Skip to content

JordanEC/rabbitmq-sample-covid-19

Repository files navigation

Sample covid-19 updates broadcaster

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

How to run

  • 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=CA

    Listen updates of Costa Rica
    ./gradlew receiver:bootrun -Pargs=--server.port=8082,--topic.continent=CA,--topic.country=CRC

    Listen updates of North America
    ./gradlew receiver:bootrun -Pargs=--server.port=8083,--topic.continent=NA

    Listen updates of United States
    ./gradlew receiver:bootrun -Pargs=--server.port=8084,--topic.continent=NA,--topic.country=USA

    Listen updates of South America
    ./gradlew receiver:bootrun -Pargs=--server.port=8085,--topic.continent=SA

    Listen updates of Brazil
    ./gradlew receiver:bootrun -Pargs=--server.port=8086,--topic.continent=SA,--topic.country=BRA

    Listen updates of Europe
    ./gradlew receiver:bootrun -Pargs=--server.port=8087,--topic.continent=EU

    Listen updates of Germany
    ./gradlew receiver:bootrun -Pargs=--server.port=8088,--topic.continent=EU,--topic.country=DEU

    Listen updates of Italy
    ./gradlew receiver:bootrun -Pargs=--server.port=8089,--topic.continent=EU,--topic.country=ITA

    Listen updates of Spain
    ./gradlew receiver:bootrun -Pargs=--server.port=8090,--topic.continent=EU,--topic.country=ESP

    Listen updates of Asia
    ./gradlew receiver:bootrun -Pargs=--server.port=8091,--topic.continent=AS

    Listen updates of China
    ./gradlew receiver:bootrun -Pargs=--server.port=8092,--topic.continent=AS,--topic.country=CHN

    Listen updates of South Korea
    ./gradlew receiver:bootrun -Pargs=--server.port=8093,--topic.continent=AS,--topic.country=KOR

Releases

No releases published

Packages

No packages published

Languages