Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/santosjennifer/microservices-cambio-book
Microserviços ms-eureka-server, ms-gateway, ms-cambio e ms-book
https://github.com/santosjennifer/microservices-cambio-book
flyway java maven mysql spring-boot spring-cloud
Last synced: 6 days ago
JSON representation
Microserviços ms-eureka-server, ms-gateway, ms-cambio e ms-book
- Host: GitHub
- URL: https://github.com/santosjennifer/microservices-cambio-book
- Owner: santosjennifer
- Created: 2024-03-21T12:49:34.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-07-15T18:13:20.000Z (4 months ago)
- Last Synced: 2024-07-16T15:20:41.517Z (4 months ago)
- Topics: flyway, java, maven, mysql, spring-boot, spring-cloud
- Language: Java
- Homepage:
- Size: 82 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![Last Commit](https://img.shields.io/github/last-commit/santosjennifer/microservices-cambio-book)
[![Continuous Integration with Github](https://github.com/santosjennifer/microservices-cambio-book/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/santosjennifer/microservices-cambio-book/actions/workflows/docker-publish.yml)## Sistema para controle de venda de livros
Responsável por retornar o valor de venda de livros de acordo com a moeda (câmbio) desejada.### Repositório com os microserviços ms-eureka-server, ms-gateway, ms-cambio e ms-book.
- **ms-eureka-server:** responsável por registrar e gerenciar a comunicação dos demais microserviços (ms-gateway, ms-cambio e ms-book).
- **ms-gateway:** responsável gerenciar as rotas do API Gateway.
- **ms-cambio:** responsável por retornar o valor do cambio de acordo com a moeda.
- **ms-book:** responsável por retornar os dados de um livro e seu valor retornando pelo cambio.### Tecnologia
- Java 21
- Maven
- Spring Boot 3.2.5
- RabbitMQ
- MySQL
- Flyway
- Resilience4j
- Zipkin
- Docker### Como executar o projeto:
1. Clone o repositório:
```
git clone [email protected]:santosjennifer/microservices-cambio-book.git
```2. Na raiz do projeto, execute o comando:
```
docker-compose up
```3. Acesse o Swagger da aplicação:
- **ms-cambio:**
```
http://localhost:8000/swagger-ui/index.html
```
![image](https://github.com/santosjennifer/rest-microservice/assets/90192611/c98b55b4-ad97-4410-ace5-e407cfd1b54b)- **ms-book:**
```
http://localhost:8100/swagger-ui/index.html
```
![image](https://github.com/santosjennifer/rest-microservice/assets/90192611/b54bb04b-ccda-4752-a25d-fa9f1ef2ebcf)### API
**GET Cambio:**
Request:
```
curl --location 'http://localhost:8000/cambio/55.0/USD/BRL'
```
Response:
```
{
"id": 1,
"from": "USD",
"to": "BRL",
"conversionFactor": 5.73,
"convertedValue": 315.15,
"environment": "8000"
}
```**GET Book:**
Request:
```
curl --location 'http://localhost:8100/book/2/BRL'
```
Response:
```
{
"id": 2,
"title": "Design Patterns",
"author": "Ralph Johnson, Erich Gamma, John Vlissides e Richard Helm",
"launchDate": "2017-11-29T15:15:13.636+00:00",
"price": 45.1,
"environment": "Book port 8100 Cambio port 8000"
}
```
**GET Cambio via API Gateway:**Request:
```
curl --location 'http://localhost:8765/cambio/44/USD/BRL'
```
Response:
```
{
"id": 1,
"from": "USD",
"to": "BRL",
"conversionFactor": 5.73,
"convertedValue": 252.12,
"environment": "8000"
}
```**GET Book via API Gateway:**
Request:
```
curl --location 'http://localhost:8765/book/4/BRL'
```
Response:
```
{
"id": 4,
"title": "JavaScript",
"author": "Crockford",
"launchDate": "2017-11-07T15:09:01.674+00:00",
"price": 67.1,
"environment": "Book port 8100 Cambio port 8000"
}
```### Eureka Server:
![image](https://github.com/santosjennifer/rest-microservice/assets/90192611/ba69625d-bcbe-4ace-b77c-9c6ed90e7e6a)