renatompf / poc_spring_rabbitmq

Small project made in Java to understand the basics of RabbitMQ

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

poc_rabbitmq

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.

Modules

Rest Module

This module is responsible for receiving calculation requests through RESTful endpoints and publishing them to a RabbitMQ queue for processing.

Endpoints

  • Sum: Add two numbers.

    • Endpoint: POST /sum
    • Example:
      {
          "firstNumber": 5.0,
          "secondNumber": 3.0
      }
  • Subtraction: Subtract one number from another.

    • Endpoint: POST /subtraction
    • Example:
      {
          "firstNumber": 10.0,
          "secondNumber": 4.0
      }
  • Division: Divide one number by another.

    • Endpoint: POST /division
    • Example:
      {
          "firstNumber": 12.0,
          "secondNumber": 3.0
      }
  • Multiplication: Multiply two numbers.

    • Endpoint: POST /multiplication
    • Example:
      {
          "firstNumber": 7.0,
          "secondNumber": 2.0
      }

Calculation Module

This module listens for incoming calculation messages from the RabbitMQ queue, performs the requested calculations, and sends back the results.

Getting Started

  1. Clone the repository.

    git clone https://github.com/renatompf/poc_rabbitmq.git
  2. Start all the containers by making.

    make all
  3. 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.

About

Small project made in Java to understand the basics of RabbitMQ


Languages

Language:Java 92.1%Language:Dockerfile 5.8%Language:Makefile 2.1%