Mid-Assessment - Building Spring Monolithic and Microservices Applications - Library Management System #153
Replies: 47 comments 3 replies
|
Hi Akash, Sharing my code in zip file for Part 1: Monolithic Spring Boot App Thanks. |
|
Hi @akash-coded , Sharing my zip file for Part 1 here |
|
management.zip |
|
Hi please find my zip file my tcs id is kushal.naik@tcs.com |
|
Hi @akash-coded |
|
Hi @akash-coded |
|
Hi @akash-coded |
|
I am Arfaz and my employee ID is 2354634 I am getting an issue that is not able to create borrowing records I tried multiple times after noon until now |
|
Hi @akash-coded |
|
Hi @akash-coded |
|
Hi Akash, |
|
Hi @akash-coded |
|
Hi @akash-coded |
|
Hello @akash-coded please check this one https://github.com/ssagarwala/MidAssessment thanks very much. |
|
Hi Aakash, Please find attached the 3 independent microservices (Book , Author , Borrower). I have added RestTemplate by invoking BorrowRecord service insertion whenever Book service is invoked. Please review. Name: Samik Thanks |
|
Hi @akash-coded, please find attached zip file for Microservice Architecture in Library Management System API. |
|
Hi @akash-coded , Technology: |
|
Uploading LibMgmt_SathyaK_563920.zip… Hi Akash , |
|
Hello Akash, @akash-coded please check the mid assessment here and provide feedback. thanks. |
|
Hi @akash-coded, Please find the link mid-assessment below. |
|
Hi @akash-coded I have completed Mid Assessment Part-2. Please find the Screenshot Document and attached Code. Library Management System Project-Rest APIs.docx Please find below the GIT Hub Link as well |
Hi @akash-coded ,
Please find completed Mid Assessment ZIP. It has 3 micro services, Eureka service registry and API Gateway. Thanks, |
|
Hi Akash, Please find the zip file for the mid assessment. |
|
Added Assignment 1 |
|
@akash-coded Hi Aakash, Please find attached microservices created for mid-assessment for Batch April 17-2024 Thanks |
|
Hi Akash, Thanks |
|
Hi Akash, Mid Assesment Library Management.zip Thanks |

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Exercise
Part 1: Monolithic Spring Boot App
Domain: Library Management System
The application should handle books, authors, and borrowing records.
Entities:
Requirements:
Part 2: Microservices Architecture
Splitting the Monolithic App:
Author Service
Book Service
Borrowing Service
Requirements:
Bonus (for candidates to show extra effort):
Guidelines:
Assessment Points:
This assessment exercise should give you a good chance to showcase their deep understanding of both monolithic and microservices architectures in Spring Boot. Given your vast experiences, the challenge should be approachable while still allowing room for them to exhibit advanced skills and best practices.
Implementation Guidelines
Part 1: Monolithic Spring Boot Application - Library Management System
1. Setup Spring Boot Project
Visit Spring Initializr and choose:
com.tcs.library,library-managementSpring Web,Spring Data JPA,H2 Database,Lombok,Springfox Swagger UIClick
Generateand extract the zip.2. Configuration
src/main/resources/application.properties3. Entity Creation
Book.javaAuthor.javaBorrowingRecord.java4. Repositories
Create JPA Repositories for each entity.
5. Services
Implement services to manage business logic.
6. Controllers
Implement REST controllers for CRUD operations and business operations.
7. Logging
logback-spring.xml<!-- configure your logging here -->8. Swagger
Setup Swagger for API documentation.
Part 2: Microservices Architecture
1. Setup three Spring Boot Projects with the same dependencies as above but named
author-service,book-service, andborrowing-service.2. Configuration for Microservices
Similar to the monolithic configuration, adjust the database and server ports so they don't collide.
3. Entity Creation and Operations
Follow similar steps to the monolithic approach, but each microservice focuses on its domain.
For instance, the
book-servicewill be responsible for books and will only have references to author ids and not the whole author entity. This keeps our services decoupled.4. Service Communication
Use
RestTemplatefor microservices to communicate. For instance, when a book is borrowed in thebook-service, a call will be made to theborrowing-serviceto record the borrowing.5. Advanced Features
Implement service discovery, client-side load balancing, and an API Gateway if required.
This is a high-level guide. I've kept it concise for readability. Each step involves nuances, especially when partitioning monolithic apps into microservices. Proper error handling, data consistency, transaction management, and more are crucial. Given the experience level of the TCS learners, this exercise should provide a comprehensive understanding of both architectural patterns.
Migrating the Monolith to Microservices
Let's dig deeper into the microservices part:
Part 2: Microservices Architecture
1. Setup for
author-service1.1. Configuration
application.propertiesforauthor-service1.2. Entity Creation
Author.java1.3. Repository
AuthorRepository.java1.4. Controller
AuthorController.java2. Setup for
book-service2.1. Configuration
application.propertiesforbook-service2.2. Entity Creation
Book.java2.3. Service Communication
BookService.java3. Setup for
borrowing-serviceFollowing similar lines,
borrowing-servicewill have its own entity, repository, and controller. When a book is borrowed, you'd register it inborrowing-service.Expanding the exercise:
Once the three services are created, operational, and talking to each other, here are potential expansion points:
Service Discovery: Incorporate tools like Eureka Server. Each microservice will then be a Eureka client. It helps in dynamic discovery without hardcoding service URLs.
Centralized Configuration: Integrate Spring Cloud Config server. Store configurations of all services in a central place.
Resilience and Latency: Use Hystrix or Resilience4J for circuit breaking. When one service fails or is slow, you can provide fallbacks.
API Gateway: Instead of direct communication between client and services, introduce an API Gateway (like Zuul) that routes requests to appropriate services.
Tracing and Logging: Use tools like Sleuth and Zipkin for distributed tracing. Centralize logs with the ELK stack.
Data Consistency: Add mechanisms for eventual consistency. For instance, when an author is deleted, ensure that related books are also addressed (either deleted or updated). This is where patterns like Saga can play a role.
Testing: Focus on writing unit tests with Mocks and integration tests for service interaction.
Continuous Deployment/Integration: Incorporate Jenkins or GitHub Actions to automate the deployment of services.
By breaking the monolithic application into microservices and incorporating the above-mentioned tools, you will not only understand the intricacies of microservice architecture but will also appreciate the advantages (and challenges) it brings in terms of scalability, maintainability, and resilience.
Reflection:
While diving deep into microservices with Spring Boot, it's vital to notice that while we add functionality, the complexity also rises. But each tool and pattern addresses a real-world problem in microservices:
For the developers, remember, it's not about using all these tools; it's about understanding their purpose and applying them judiciously. Always relate to real-world problems, like how Netflix uses Hystrix to ensure users always get recommendations, even if the primary recommendation service fails, a fallback provides generic recommendations. Understanding the "why" behind each tool is as crucial as the "how."
All reactions