Transition from Service Oriented Architectures to Microservices - How APIs fits into Concepts of Microservices - Part 1

It's interesting how fast new architectural patterns, technologies are transforming organizations & businesses. Microservices is one such pattern which took IT by storm & It helps you to seamlessly develop, test, build, distribute, consume services inside & outside of your business territory in a much quicker way.

Microservices & APIs are very closely connected. Today, When you build a microservice,You will access same by making an API call. Some people feel that MicroServices are SOA++ . But, In reality, they are designed for very different use cases. Find more about same here.

Today most of the businesses are driven by fast-moving, app-driven integration-driven approaches. Mobile Applications evolve & innovate much faster than backend systems. Microservices pattern helps you achieve same in backend systems & innovate faster.

SOA is Big, Complex, Expensive architecture style. It's kind of closed pub-sub model where one service subscribes to others. APIs is a way to communicate with service & brings more innovation into your system. APIs are much more open & provide flexibility to innovate.

Microservices pattern helps you solve problems you see with large enterprise SOA systems, scalability, security issues that you normally see with big monolithic applications. Today, MicroServices architecture style is common across new companies / businesses who is building their services.

In series of articles, I would like to compare how architecture patterns differ between SOA & Microservices and also how Apigee fits into Microservices pattern.

Both SOA & Microservices are service-based architectures. One of the main principles of service-based architecture is dividing services into modules so that each service can be independently designed, developed, tested, built, deployed, scaled and consumed without disturbing other services. It also introduces complexities like Service Contracts ( Agreements between consumer & service) , securing, scaling, managing, analyzing, connecting services. Let's see how Apigee solves these issues with ease moving forward & how exactly you can leverage APIs - MicroServices using Apigee.

Let's build a simple micro service using Node.JS. Let's take a real world of example e-retail / e-commerce.

Let's start with Product API which lists product information & different variations defined using SKU's. Endpoints are ,

GET /product/:productId

GET /product/:productId/skus

GET /product/:productId/skus/:skuId

We are going to mock the responses instead of retrieving same from the backend database. You can find attached API implementation of productMicroService.

productmicroservice.zip

To run above microservice follow below steps,

  • Make sure Node.Js is installed in your machine
  • Download & Unzip above attachment
  • Navigate into the folder from command line
  • Execute below command to start microservice
node server.js

http://127.0.0.1:3000/product/1234

http://127.0.0.1:3000/product/1234/skus

http://127.0.0.1:3000/product/1234/skus/12345

When you are building microservices / service based architectures you need to solve issues like Security, Using right remote access protocol, Service Contracts, Unresponsiveness & Unavailability of services, Distributed Transactions and much more complex issues. In series of articles let's discuss how do we do it using microservices & open source tools.

Keep me posted with any feedback in the comments section below & follow me if you are interested in these articles.

Version history
Last update:
‎07-14-2016 05:39 AM
Updated by: