- Spring Cloud Gateway
- Eureka Server
- RabbitMQ
- Docker
- OpenFeign
Use the links below to go to the URLs
Microservice | Name | Http method | Link | Body / Query |
---|---|---|---|---|
user-controller | postNewUser | POST | http://localhost:8080/users | { "cpf": "valid cpf", "name": "your name"} as json body |
user-controller | getUsers | GET | http://localhost:8080/users/{id} | userId (String cpf) as path variable |
poll-controller | getPollVoted | GET | http://localhost:8080/polls/voted | - |
poll-controller | deletPollById | DELETE | http://localhost:8080/polls/{pollId} | pollId (integer) as path variable |
poll-controller | updatePollAsActive | PUT | http://localhost:8080/polls/{pollId} | pollId (integer) as path variable} |
poll-controller | postNewPoll | POST | http://localhost:8080/polls | { "name": "improvement namme", "minutesActive": } as Json body |
poll-controller | getPollById | GET | http://localhost:8080/polls/{id} | pollId (integer) as path variable} |
poll-controller | getAllPolls | GET | http://localhost:8080/polls/all | - |
vote-controller | getVoteByPoll | GET | http://localhost:8080/votes/listByPoll?pollId= | {"pollId" : "pollId"} as query params} |
vote-controller | postNewVote | POST | http://localhost:8080/votes?cpf=&pollId= | { "cpf": "cpf", "pollId": "pollId"} as query params |
- Establishes routes to each microservices
- Registers microservices to be found and used by other microservices
- Registers a new poll of improvements into the database
- Sets a registered poll as active to receive votes
- Sets a registered and active poll as voted when it finishes
- Returns all polls registered
- Returns all registered polls voted
- Deletes a poll
- Registers a new user into the database
- Checks if user information (CPF) is valid
- Returns a registered user
- Registers new votes into the database
- Uses OpenFeign to request data to Ms-user and Ms-poll
Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure, so you can deliver software quickly. Source
- Log into RabbitMQ using 'guest' as username and password
- Then create to regular queues as 'result-publisher-string' and 'result-publisher'
- Ms-voting uses both as publisher
- Ms-user uses 'result-publisher-string' as consumer to show what are the results for each poll
- Ms-poll uses 'result-publisher' as consumer to update poll's result value
- Finally use docker commands
docker compose build
- To download and update the containers
docker compose up
- To run the containers
Each project has its own Dockerfile containing instructions to build the images
This file sets how each container should act while running with docker
While in development, we decided to use a specific designed by user netowrk to manage communication between the containers, setting fixed IPs to each microservice
stateDiagram
HARDWARE --> OS
state OS {
DOCKER --> msvoting
DOCKER --> msuser
DOCKER --> eureka
DOCKER --> mspoll
DOCKER --> gateway
}
state mspoll {
[*] --> javaCoretoAmazonA
[*] --> alpinelinuxA
}
state msuser {
[*] --> javaCoretoAmazonB
[*] --> alpinelinuxB
}
state msvoting {
[*] --> javaCoretoAmazonC
[*] --> alpinelinuxC
}