Microservices – also known as the microservice architecture – is an architectural style that structures an application as a collection of loosely coupled services. Building a single microservice is easy. Building a microservice architecture is extremely hard. It is basically distributed system design and development.
A microservices architecture makes more sense when we compare it with monolithic application design. In monolithic architectural design we create a big cumbersome application with all modules tightly coupled inside a single executable, which is typically deployed on a web or application server.
This architecture type is a particular way of developing software, web or mobile applications as suites of independent services also known as microservices. These services are created to serve only one specific business function called service such as: user management, user roles, e-commerce cart etc. furthermore, they are independent of each other.
There are differences between SOA (Service Oriented Architecture) monoliths and Micro services architecture :
Classic SOA is often implemented inside deployment monoliths and is more platforms driven while microservices must be independently deployable and therefore offer more flexibility in all dimensions. The key difference of course is the size, the word micro says it all – they tend to be significantly smaller than regular SOA is.
Advantage and Disadvantage of Microservice:
USE CASE (SEARCH APP):
- Three services used
- Accept input from user and return result object – service name: api-gateway
- Used Apache camel (rest , route) to get the request from user and route the request to different services.
- Generate query object based on criteria given by user and return this object to api-gateway – service name: query-generator
- Used Spring Boot(Rest) to provide services
- Fetch the data from different resources and return it back to api-gateway service – service name: data-accessor
- Used Spring-jdbc to communicate with database
USE CASE DIAGRAM :
Component Used :
- Apache Camel
- Spring boot
- Apache Camel :
Apache Camel is an open source Java framework that focuses on making integration easier and more accessible to developers. It does this by providing:
- concrete implementations of all the widely used Enterprise Integration Patterns(EIPs)
- connectivity to a great variety of transports and APIs
- easy to use Domain Specific Languages (DSLs) to wire EIPs and transports together
- Spring Boot :
Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can “just run”. We take an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration.
- Create stand-alone Spring applications
- Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR files)
- Provide opinionated ‘starter’ POMs to simplify your Maven configuration
- Automatically configure Spring whenever possible
- Provide production-ready features such as metrics, health checks and externalized configuration
- Absolutely no code generationand no requirement for XML configuration
- Spring-Jdbc :
This part of the spring component is concerned with data access and the interaction between the data access layer and the business or service layer.
As you can see, a lot of the same points are covered, but a lot of new explanations and thoughts about microservices are uncovered as well. Microservices may be an overhyped concept, but it’s exciting to think about the ways they can change the industry regardless.