First, start kafka and kafdrop (kafka ui interface) running the command:
docker-compose up -d
To start all applications at the same time, run the following command:
pnpm run dev
This command should start the ms-auth & ms-voting microservices and the api-gateway application
Make a post call to http://localhost:3000 sending a JSON body like so:
{
"userId": "456",
"votingId": "111",
"vote": "F"
}
where:
- userId can be '123' or '456'
- votingId can be any string
- vote can be any string
You should see something like this into application LOG:
ms-voting:dev: User Peter Smith voted F for the voting 111
This simple monorepo shows how to setup microservices to communicate (kind of) each other using synch/asynch messages through Kafka.
It uses request-response message style and event-based message style.
For voting service, the ms uses event-based style.
For getting user information, the ms uses message-response style.