Skip to main content

MicroServices - GateWay Pattern

What After Creating MicroServices

Now in our previous post we discussed how to break your monolithic application into microservices but now question arise what after services how client will know about all services that we have created. One way is that our client application will make request to all services as per need and deal with the response to show the result to user. I.e we will be having all details of services like url, port to client side and on
basis of that client will make request to requires resources/service. But this architecture has disadvantage like if we changed the service location to some other server then again we have to do all changes related to that service in all location in client application which will be a tedious job to do.

Figure 1

How to Solve Above Problem

What if we have some Interface that will take request from client and transfer that request to required services. This interface will act as the mediator that will bind client request to services. This interface will be called as the Gateway
Suppose we have order management application with following services 
  • Order Service 
  • Customer Service 
  • Kitchen Service
Now when we do not have the gateway then that time client has to remember all the services url to make an request as shown in above figure 1. This is not case with the gateway when following gateway pattern client application need not to remember about the services it only have to remember gateway url to make any request rest gateway will take care of. Gate will find specific service and route the request to required services as shown in figure 3. If any of the services is shifted to other server or port then that change needed to be updated at gateway. 
Figure 2

Points to be noted about Gateway
  • GateWay is entry point to our services.
  • Gate will act as the router that will routes all request from client to there specific services.
  • GateWay Insulates clients from how application is decomposed into several services.
  • GateWay reduces the burden of client from remembering request url of each client. 

Disadvantage about Gateway

  • It increases the complexity of the application.
  • It increases the response time due to extra hop that gateway has to make
Now its lot of theory about microservices now lets dive into the in next post.

If you haven't gone to my previous code then please feel free to go through it.
Please feel free to comment below about your view and any extra clarification you require.

Comments

Popular posts from this blog

Routing in Angular 7

What you will learn after reading this post.What is Routing in Angular 7.Basic routing of component in Angular 7.Active link in routing in Angular 7.Wild card routing in Angular 7.Child routing in Angular 7.1. What is Routing in Angular 7? Whenever in normal HTML web page we click on a link we are navigated to specific page given in that link. When we are navigated then entire view of the application is reloaded again which cost resources and this type of application is not single page application. 

Creating Simple Hello World Application with SPRING BOOT

For creating a simple running web application with spring boot we do not have to do much. We just require to follow some simple steps and we are good to go. Unlike SpringMVC framework we do not. have to take care of all heck of configuration or XML file in one go we are all set with working mvc based web application.

Now we have to follow these steps.

Generate spring boot project from this url "https://start.spring.io/" You can do the same using STS setting to.Importing the project in STS.

Feature Modules in Angular 7

Feature Module Whenever we  create angular application we go on adding components to angular application. But as our application goes on increasing it become to much problematic to maintain such application. Every feature of our application is binded under single module which we call as app module. Which is root module of our Angular 7 application. While developing angular application without modularizing its features creates several problems  Application is not easily scalable.Application is tough to maintain.Application complexity makes it hard to understand. Solution Here feature modules comes for our rescue. Feature modules help angular applications to get modularised on basis of features present in our application. As our application grows we can divide our entire application in small feature using feature module. Feature modules helps in creating boundary that separates our specific functionality or say features. Feature modules communicates with other module or root module usin…

Adding Spring-Security to Spring-Boot App

In the previous post we have created a simple spring boot application. This application was very simple application just getting request and showing page for requested URL. Currently all urls are open to all user that is we do not have any kind of authentication on the URL. Our spring boot application is like the open pool in which any one can come and start fishing. Now we want to secure our application so that only authenticated user will be able to visit secure part of the application. For this purpose we will be using the Spring Security. 
Scope of this tutorial. In this we will learn basic integration of spring security with spring boot.
NOTE: This tutorial will just contain only basic integration of spring security. If you haven’t gone through previous tutorial and you are the newbies to this spring boot then I will request you to go through previous post to get understanding of spring boot. 
Now lets get started with the configuration.If you do not have the previous code you can …

Decompose Monolithic Application To Microservices

How To Decompose Application into Microservices. After reading the previous two posts you all must be excited to implement microservice architecture to your application and that's good you should be ready to implement something new that might boost the application performance,  maintenance, scalability and will make your application future proof. But have you ever thought how will you be breaking your application into micro application i.e microservices. Think about it for some minute exercise your brain for some time before reading the below tutorial.

Now i am sure that you all might  have come through excellent ideas for breaking up your application in microservices. Please feel free to mention your valuable ideas in comment so that other or even me can be benefited by your ideas.

Now before breaking your application into micro-services you should consider following points.
Points to be considered before creating microservices.Your each services should be easily testable.Your a…

Monolithic Application Architecture

In regular web development process what do we do? We create one war file which contains all functionality, services, modules or all use cases related to our business. In this approach of development we do not focus to make our application modularise. We may be following modularization in our code but end product is not seperated. Every services, modules are bundled up in single war and this war is deployed on server so that our business will be available for outside world which can make a request to get the required resources. This native architecture of development is called Monolithic Architecture.