In this post we will see how a spring based restful microservice architecture looks like and detailed steps to implement this architecture. Since this is a vast topic, I will divide this post into multiple posts. In the first post (Part 1), we will see the spring based Microservice Architecture for a simple use case. Identify various components and tools that will be used to implement this architecure.
Without spending too much time on the basics, we will dwelve right away into the overall architecture.
Tools and Technologies used :
Installation of Spring Tools Suite, Postman and Java JDK 8 are straight forward and I will not go into details of these installations.
Steps Involved in creating springboot microservices:
In Part 1 of this series, we will see how to implement the below features:
Without spending too much time on the basics, we will dwelve right away into the overall architecture.
Tools and Technologies used :
- Spring Tool Suite (https://spring.io/tools3/sts/all)
- Postman (https://www.getpostman.com/apps)
- mongoDB (https://www.mongodb.com/download-center/community)
- Java 8
Installation of Spring Tools Suite, Postman and Java JDK 8 are straight forward and I will not go into details of these installations.
Steps Involved in creating springboot microservices:
In Part 1 of this series, we will see how to implement the below features:
- mongoDB Installation and Configuration.
- Create a customer microservice (Spring Modules : web, Eureka Client, mongoDB)
- Connect customer microservice to mongoDB for data retrieval and updates.
- Expose the customer microservice as Rest service on server port : 8100
- Added methods for
- FindCusotmerByLastName : localhost:8100/rest/cust/Paul
- AddCustomer : localhost:8100/rest/cust/add
- DeleteCustomer : localhost:8100/rest/cust/delete/5bd2110a6cb1615f64372a5e
- Create an inventory microservice (Spring Modules: Web, Eureka Client, mongoDB)
- Connect inventory microservice to mongoDB for data retrieval and updates.
- Expose the customer microservice as Rest service on server port : 8101
- Added methods for
- Get all inventory : localhost:8101/rest/inventory/
- Add Inventory : localhost:8101/rest/inventory/add
- Increment Quantity : localhost:8101/rest/inventory/{sku}/increment
- Decrement Quantity : localhost:8101/rest/inventory/{sku}/decrement
- Create an cart microservice (Spring Modules: Web, H2 DB, Eureka Client)
- Connect cart microservice to H2 Database for data retrieval and updates.
- Expose the customer microservice as Rest service on server port : 8102
- Added methods for
- Get all Cart Items: localhost:8102/rest/cart/
- Add Cart Item : localhost:8102/rest/cart/add
- Remove Cart Items : localhost:8101/rest/inventory/{sku}/increment
- Create a service registry (Spring Modules : Web and EurekaServer)
- Register Cart Microservice as “cart-service”
- Register Inventory Microservice as “inventory-service”
- Register Customer Microservice as “cust-service”
- Create API Gateway (Spring Modules : Spring Netflix Zuul)
- Enable Zuul Proxy at : http://localhost:8150
- Configure routes for microservices as below:
- Cart service : http://localhost:8150/cart-service/rest/cart/
- Inventory Service : http://localhost:8150/cart-service/rest/cart/
- Customer Service : http://localhost:8150/cart-service/rest/cart/
Comments
Post a Comment