Skip to content

A microservice application built with RabbitMQ, Docker, Spring Boot, Eureka Server, and API Gateway, with external API consumption (The Cat API & The Dog API),

Notifications You must be signed in to change notification settings

LauriESB/microservices-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

🐈‍⬛🐩 Pet API 🐕🐈

Pet API is a system that allows the registration of dogs and cats based on breeds and images from external APIs TheCatAPI and TheDogAPI. It also handles appointment registrations for services like vaccinations, baths, medical exams, medical appointments, surgeries, and sends emails with information about the scheduled events.

🧸 Features

Cats

  • Create a cat
  • Automatically sends and e-mail for the owner if cat's age >= 10 or vaccinationHistory = 'none' with appointment data
  • Search registered cats by breed
  • Search registered cats by species

Dogs

  • Create a dog
  • Automatically sends and e-mail if cat's age >= 10 or vaccines = none
  • Search registered dogs by breed
  • Search registered dogs by species

Pets

  • View registered pets
  • Fetch pet by ID
  • Update pets by ID
  • Delete pet by ID

TheCatAPI | TheDogAPI

  • Fetch available cat and dog breeds
  • Fetch available cat and dog images

Pet Appointment

  • Create an appointment
  • Automatically sends and e-mail for the owner with appointment data
  • View appointments
  • Update appointment based on animal name, owner email, and event name
  • Delete an appointment based on animal name, owner email, and event name

Mail Sender

  • Automatically send emails for scheduled appointments (vaccines, bath, etc.) and manually registered appointments

💻⚙️ Technologies used

  • Spring Boot: Framework for building Java applications.
  • Spring Data JPA: Simplifies database integration, using object-relational mapping for persistence.
  • Maven: Dependency and build management tool.
  • MySQL: Relational database for storing entities.
  • Swagger: Interactive API documentation.
  • WebClient: For integrating with external APIs.
  • RabbitMQ: Messaging broker for communication between microservices.
  • Docker: Dockerfile and Docker Compose for containerization.
  • Eureka Discovery Client: Service discovery for microservices.
  • API Gateway: Gateway to manage and route API requests.
  • Java Mail Sender: Sends emails automatically for appointments.

🐾 How to Run

Prerequisites

Before running the application, make sure you have Docker installed on your machine.

Note: There is no need to have a JDK installed locally. Docker will handle all dependencies within isolated containers.

Getting Started

1. Clone the repository

git clone git@git.gft.com:lnsi/microserviceschallenge.git
cd microserviceschallenge/backend/deploy

2. Build and run the application

To build and start the application using Docker Compose, run the following command:

docker-compose up --build

This command will:

  • Build the application images based on the Dockerfiles in the application.
  • Create and start the containers for both the Spring Boot application and the MySQL database.
  • Set up the necessary environment variables for the database connection.

Important

AFTER RUNNING THE COMMAND, WAIT FOR THE MESSAGE 'RUNNING THE EVICT TASK WITH COMPENSATIONTIME 0MS' TO APPEAR, THEN GO TO STEP 3.

3. Access the application

You can make the HTTP requests now. Access petAPI.postman_collection.json located in backend/

4. Stopping the application

docker-compose down

📖 Swagger documentation ports

Registry API

Appointment API

About

A microservice application built with RabbitMQ, Docker, Spring Boot, Eureka Server, and API Gateway, with external API consumption (The Cat API & The Dog API),

Topics

Resources

Stars

Watchers

Forks