This is a Spring Boot project that implements a calculator service using RabbitMQ for message-based communication.
The project is split into two modules: one that accepts requests, and the other that performs calculations after reading messages from the queue.
This module is responsible for receiving calculation requests through RESTful endpoints and publishing them to a RabbitMQ queue for processing.
-
Sum: Add two numbers.
- Endpoint:
POST /sum
- Example:
{ "firstNumber": 5.0, "secondNumber": 3.0 }
- Endpoint:
-
Subtraction: Subtract one number from another.
- Endpoint:
POST /subtraction
- Example:
{ "firstNumber": 10.0, "secondNumber": 4.0 }
- Endpoint:
-
Division: Divide one number by another.
- Endpoint:
POST /division
- Example:
{ "firstNumber": 12.0, "secondNumber": 3.0 }
- Endpoint:
-
Multiplication: Multiply two numbers.
- Endpoint:
POST /multiplication
- Example:
{ "firstNumber": 7.0, "secondNumber": 2.0 }
- Endpoint:
This module listens for incoming calculation messages from the RabbitMQ queue, performs the requested calculations, and sends back the results.
-
Clone the repository.
git clone https://github.com/renatompf/poc_rabbitmq.git
-
Start all the containers by making.
make all
-
Use the provided endpoints to perform calculations. For example, send a POST request to http://localhost:8080/sum with the request body as shown in the examples above.