https://github.com/guilhermebit/btg-pactual-back-end-challenge
🧩 Microservice developed in Spring Boot, RabbitMQ, MongoDB and Docker
https://github.com/guilhermebit/btg-pactual-back-end-challenge
btg-pactual challenge docker java junit junit5 microser microservice mockito mongodb rabbitmq springboot
Last synced: 4 months ago
JSON representation
🧩 Microservice developed in Spring Boot, RabbitMQ, MongoDB and Docker
- Host: GitHub
- URL: https://github.com/guilhermebit/btg-pactual-back-end-challenge
- Owner: Guilhermebit
- License: mit
- Created: 2024-09-13T19:34:22.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2025-01-28T15:35:28.000Z (4 months ago)
- Last Synced: 2025-01-28T16:32:59.243Z (4 months ago)
- Topics: btg-pactual, challenge, docker, java, junit, junit5, microser, microservice, mockito, mongodb, rabbitmq, springboot
- Language: Java
- Homepage:
- Size: 52.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BTG Pactual Back-end Challenge
[](https://hub.docker.com/r/guibitencurt/order-microservice-rabbit-mongo)
[](https://github.com/Guilhermebit/btg-pactual-back-end-challenge/actions/workflows/ci.yml)
[](https://github.com/Guilhermebit/btg-pactual-back-end-challenge/blob/master/LICENSE)Microservice developed to address the [BTG Pactual challenge](./PROBLEM.md). The challenge involves creating a microservice that:
- Consumes data from a queue
- Stores this data in a database
- Provides functionality to:
- Retrieve the total amount of an order
- Get the total number of orders for a customer
- List orders made by a customer## This project has the following architecture:
![]()
## Tecnologies
- ✅ Java 21
- ✅ SpringBoot
- ✅ Spring Data MongoDB
- ✅ RabbitMQ
- ✅ Docker
- ✅ JUnit 5 + Mockito(unit tests)
- ✅ IntelliJ IDEA Community Edition 2023.2.2## :rocket: Installation
1. Clone the repository:
```
$ git clone https://github.com/Guilhermebit/btg-pactual-back-end-challenge.git
```
2. Install dependencies with Maven3. Install docker: https://docs.docker.com/engine/install/
4. Run the following command:
```
./mvnw clean install
```
## Usage
1. Run the following command:
```
docker-compose up
```
2. Access RabbitMQ at http://localhost:15672
- Login using the default credentials (usually `guest`/`guest`).
- Navigate to the "Queues" menu and select the relevant queue.
- Paste the provided payload from the challenge into the Payload field.
- Click on "Publish Message" to send the message to the queue.
3. The API will be accessible at http://localhost:8081.
## Api EndPoints
To test the HTTP requests, you can use Postman.
Download Postman here: https://www.postman.com/downloads/## List customer orders
`GET /customers/{customerId}/orders`
+ Response 200 (application/json)+ Body
```json
{
"data": [
{
"orderId": 1001,
"customerId": 1,
"total": 120.00
}
],
"pagination": {
"page": 0,
"pageSize": 10,
"totalElements": 1,
"totalPages": 1
}
}
```
## TroubleshootingIf you encounter issues, consider the following:
- Ensure all services are running properly in Docker.
- Check Docker logs for any errors related to RabbitMQ or MongoDB.
- Verify that the configuration files are correctly set up.