Skip to content

ikk1/microservices

Repository files navigation

Microservices Example with Clean Architecture and Spring

This project aims to study and implement the Clean Architecture pattern using Spring and RabbitMQ as a means of communication. It consists of two applications:

  1. Student Registration: A simple application that allows users to register as students.
  2. Email Service: A service that listens to a RabbitMQ queue and sends an email whenever a new student is registered.

The project also includes a Docker Compose file to easily start all the required components.

Technologies Used

  • Spring Boot: Java framework for creating microservices.
  • Clean Architecture: Software design pattern that promotes separation of concerns.
  • RabbitMQ: Message broker for asynchronous communication between applications.
  • Docker: Platform for building, shipping, and running applications in containers.

Getting Started

To run the project, follow these steps:

  1. Install Docker and Docker Compose.
  2. Clone the repository:
git clone https://github.com/ikk1/microservices.git
  1. Go to the project directory:
cd microservices
  1. Build and start the applications with Docker Compose:
docker-compose up

Registering a New Student

Send a POST request to http://localhost:8080/students with the following request body format:

{
  "name": "Student Name",
  "email": "[email protected]",
  "address": "Student Address",
  "course": "MATH"
}

Replace the values as needed. The course field should be one of the following options: MATH, SCIENCE, HISTORY, or ENGLISH, indicating the student's course.

Viewing the List of Students

Make a GET request to http://localhost:8080/students to retrieve a list of all registered students.

It will return a list of students in the following format:

[
  {
    "id": 1,
    "name": "Student Name",
    "email": "[email protected]",
    "address": "Student Address",
    "course": "MATH"
  },
  {
    "id": 2,
    "name": "Another Student Name",
    "email": "[email protected]",
    "address": "Another Student Address",
    "course": "SCIENCE"
  },
  ...
]

Note: The Email Service application is not accessible via a web browser. It runs in the background and listens to the RabbitMQ queue. The email is sent to the address specified in student registration.

Contributing

If you find this project useful, feel free to contribute by:

  • Reporting bugs or suggesting improvements.
  • Submitting pull requests with your changes.

License

This project is licensed under the MIT License.

References

Additional Information

This is a basic example of microservices using Clean Architecture and Spring. For more information on these topics, please refer to the resources mentioned above.

Contact

If you have any questions or feedback, please feel free to contact me at [email protected].

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published