Skip to main content

Spring Based Restful Microservice Architecture and Implementation - Part 1

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 :

  1. Spring Tool Suite (https://spring.io/tools3/sts/all) 
  2. Postman (https://www.getpostman.com/apps) 
  3. mongoDB (https://www.mongodb.com/download-center/community) 
  4. 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 
In Part 2 of this series, we will see how to implement the below features:
  • 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 
In Part 3 of this series, we will see how to implement the below features:
  • 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 
In Part 4 of this series, we will see how to implement the below features:
  • 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

Popular posts from this blog

Outsystems Tips and Tricks : Adding iFrame in Reactive Web App

In Outsystems Version 11+, there is no iFrame widget available when you are building Reactive Web Applications. So in case you want to add an iFrame HTML tag or for that matter any other HTML element, you could do so by creating a generic web block and pass HTML in to it by doing as follows.

Consuming Workday WSDL into Outsystems

WSDL (Web Service Description Language) is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information. The operations and messages are described abstractly, and then bound to a concrete network protocol and message format to define an endpoint . Generally consuming a WSDL (Webservice Description Language) in Outsystems is an easy task but it might get trickier when the WSDL has unsupported use cases built into it. This article will help to understand the difficulties associated with such unsupported use case and attempts to provide a solution. Here is the list of unsupported SOAP use cases from Outystems: https://success.outsystems.com/Documentation/11/Extensibility_and_Integration/SOAP/Consuming_SOAP_Web_Services/Unsupporte d_SOAP_Use_Cases#list-attribute-in-a-single-list-attribute Workday WSDL: The following link provides the WWS (Workday Web Services) API Documentation f...

Outsystems Integrations - Connecting to Microsoft Azure Sql Server

In this article, I will show you how to set up your own Microsoft Azure SQL Server Database and then how to integrate this SQL Server database in Outsystems. Create a free Microsoft Azure Account. https://portal.azure.com. Microsoft Azure is a cloud computing service for building, deploying and testing application through Microsoft managed data centers (similar to Amazon’s AWS services) Microsoft provides free accounts with free credit of $200 to spend in the first year of new account. I am using this feature to create a Microsoft Azure SQL Server database in the cloud and will show how easy it is to connect this Azure AQL Server from Outsystems. Click on Add button to add a Azure SQL Database Fill in the details and click on Create button. Your deployment will take few seconds to few min to create. Look for the status in the table. It will change to Created automatically without refreshing the screen and finally when your screen says deployment is compl...