Recap
Last week, we explored the microservices architecture and the communication patterns between services within a system.

Figure 8.1 Monolithic architecture and microservice architecture.
In our previous discussion, we also addressed the challenges associated with managing data in distributed systems, but we left off with an important question. To answer this, we will look at a sample project based on the microservice architecture.
- We will see how JAXB annotations can be implemented in our code.
- Implement microservice using REST API and configure web.xml.
- Implement frontend and backend of the project.
- Implement authentication mechanism using JSON Web Token.
The project we will be referring to is provided in the .zip
below:
Lab4Codes.zip
Microservice Design
In our sample project, there are four microservices:
- FrontEnd: Responsible to provide GUI for the project, retrieve information from other services, check the login and apply authentication mechanisms.
- It has
Account_LBS
database with an ACCOUNT
table.
- SearchBooks: Responsible for searching over books based on book title, and book authors.
- It has
Search_LBS
database, which include BOOK
, AUTHOR
, and BOOK_AUTHOR
tables.
- BorrowBook: Responsible to provide information about books that have been borrowed by a user, also perform borrowing and returning books.
- It is related to the Hold microservice, because it needs to check whether a book is on hold or not to decide whether a book can be borrowed.
- It has
Borrow_LBS
database with BOOK_BORROW
and BOOK_HOLD
tables.
- HoldBook: Responsible for retrieving data on whether a book is on hold, and also perform holding a book for a user.
- It is related to the Borrow microservice, because it needs to check the date a book will be available for holding.
- It has
Hold_LBS
database with BOOK_BORROW
and BOOK_HOLD
tables
Each microservice is its own independent project with their own database schema.

Figure 8.2 NetBeans project panel.