Skip to main content

Organizing microservices - Modern Integration


Microservices is probably one of the most popular buzz among my fellow developer friends, and I do like the concept of being flexible, agile and having simply having more choices. But as a person that worked in the software integration space for years, I started to see some resemblance of the old ESB days.

Looking at the problem from ten thousand feet up. A decade ago, we had to come up with a better way of organizing the spaghetti connection in between systems, stop duplicating effort on the same piece of business logic. That is when Service oriented architecture(SOA) became popular. By modularizing services, sharing them among others systems, and organize ways of communication, routing of data. And ESB is one implementation of that, maybe not necessary how it should be done.

I was very fortunate to participate in many of these kind of integration projects, and lead some myself. We worked with various middleware vendors, at the time the solutions was all about ESB. By removing the complex interconnecting logic between systems into ESB, negotiating data model among teams (with application/services leaders), setup WSDL contracts for webservices and adding BPEL processes if needed between calls. And I had seem a fair share of amount of these ESB myself, outside of ESB the everything seems very organized. But lift up the ESB “box” you will find many of them end up with even worst tangled spaghetti code (or diagrams depends on your tooling). And that giant bundle of chaos, then become the bottleneck in delivering changes in enterprise.
(On the side note. This is when I started on the lightweight ESB idea, and how I was introduced with Camel, Karaf, servicemix because it solves my problem of being to independently bundle my integration code and breaking that ESB box into smaller distribution..and so on..)
When the idea of independently deployable microservices came along. This giant monolithic monster with idea of smart pipe where it tries to do too much, like data model definition, process flow, interconnect protocols and data format transform ...etc  and dumb endpoint where services just waits to be activated by events was soon cast aside by developers. The relation between each services  are still messy and the monolithic nature make the cycle of development long and cumbersome. The microservice allows developer to be more agile, who needs that piece of “Integration”. So this where the resemblance of a problem where I once trying to solve :)
And let alone we still need to interact with other services(systems/applications) outside microservices. So learning from past here are the things we know what NOT to do..

  • No more large monolithic bundles application to speed up the dev cycle.
  • Stop doing complex business process inside system integration code
  • Data model shouldn’t be defined in the integration layer, it only leads to extra negotiation between teams.
  • State should not be keeped in the integration layer to allow maximum scalability
  • Create fix complex contracts between services.

And still there are things we liked about the old "integration" way.

  • Organized visualized interconnect view of systems.
  • Patterns that are already defined for integrating applications such as aggregations, separation, normalization of data.
  • Event-based approach. A more reactive way and less coupled ways to integration systems.

And that is why I came up with the layered architecture for microservice. The main goal that I wanted to achieve in the new integration architecture in the modern integration/application development is flexibility. Not only in the scalable way but also allowing developer to make any architectural change with ease.
So first thing first, in the new modern agile integration, the integration code itself should be sorted into different small services that make sense in the business world. And are decoupled and made them to be independently deployable microservices units. Then we can start apply true CI/CD to the integration code. This will avoid becoming a large monolithic ESB.

In order to bring some logical sense to my microservice spaghetti, and avoiding repeating the mistake of taking on too much in one single integration bundle. I have defined four layers for my microservice, so each will have it’s own responsibility making it easier to adopt changes.
  • Gateway layer  Provides simple gateway routing capability such as versioning, dealing with different platform of devices.
Originally I want to divide this layer into two, but decide not to because the gateway pattern has become so popular now, people has the perception of gateway should achieve certain ability. (That is a whole other story I want to talk some other time). That is why I have two separate form of the gateway in my diagram, one represents as green other blue.

It’s all about the separation of concerns. This layer is all about generating putting together what is needed for external API consumption. This is where and when separate application domains tries to integrate with each other. And route to the correct versions of services. And clearly the two major concerns were,

  • Accessing policy rules, versioning of endpoints. (APIs)
    • Sets traffic throttle applying limits and policies
    • Security of  APIs
    • Routing to correct versions
  • Combine, transform return result to client.
    • Citizen developer are the main creators here, they uses the capability provided by each microservice team to put together meaningful service to external clients.
    • Collect, split, or normalized a canonical data format to external users.
    • Translate data output depending on the clients
    • Routing between application domains

  • Composite layer  Important middle tier that handles composition of multiple microservices. They do more complex routing from processing the content data and aggregates/split data and populate the split/aggregated result to other microservices by triggering events or simply passing it. This layer hides the complexity of microservices away from clients.

This layer is probably the layer that does most of the old time integration logic where it is responsible for
  • Composing microservices
    • By calling the API available from microservices, and transforming data as needed between them and routing data to the corresponding microservices based on it’s content.
  • Triggers events within domain
    • I believe strongly that event base does best at decoupling stickiness between each service. And allowing performance at it’s best because of its asynchronous nature. The event bus here doesn’t necessary has to be a message broker, but any forms of Bus.  
  • Enrich contents
    • The content enrichment here should be specific to the format and avoid any business side enrichment when possible.
  • Applying Integration patterns
    • Old integration problem will not just go away in microservices world. By applying proven patterns, we can avoid making mistakes.
  • Caching
    • The REST architecture specifically talks about a caching layer. It make sense for the composite layer to try apply caching mechanism because it’s non business related, but do make significant impact to the performance and fault tolerance ability of the system.  

The composite services should also be included in the application domain, which I will talk about in the basic layer.

  • Base layer   Like the name which is most likely represents the basic components of the system. Handles data retrieval or business logic processing. Each should be independent and self-contained.
Borrowing from the idea of Bounded Context,  in this case logically organized group of microservices into what is called application domain. Where each domain represents separate entities of business functions that shares the same data model, this eliminates the need for doing too much transformation in the code.  


  • Anti-corruption layer - This layer handles interface to legacy application or anything that work against microservice quick and flexible principle. This layer is built in protection wall to your system, by doing the transforming job and translate between two very distinct implementations of the system.  

Till next time! :)

Comments

Popular posts from this blog

Red Hat JBoss Fuse - Getting Started with Fuse Integration Service 2.0 Tech preview

I just realized that I did not do a getting started for Fuse Integration Service 2.0 Tech preview before I did the pipeline demo, thanks for those of you who reminded me! :)

To get started with FIS 2.0, for people who has just getting to know the technology, here is how I interpret it. Basically, it's divide into two aspect,

1. Integration development, FIS uses Apache Camel as the core technology that creates, orchestrate, compose microservices into a super lightweight thin integration layer, and become the API provider and service orchestrator through exposing RESTful or messaging service endpoints. And you can choose to either package and run it with Spring-Boot or Karaf.


2. Application Deployment and Management, FIS takes advantages of OpenShift platform, and allows you to separately deploy the micro-integration service among distributed environment, at the same time takes care of the failover, high availability, load balancing and service lookup problem for you.


So, now we know …

Red Hat JBoss Fuse/A-MQ - Fuse and A-MQ Version 6.3 GA is released!

Fuse and A-MQ 6.3 GA has just went out. Maybe, you would think this is just only a minor version release why should I care? Hold your thoughts on that! Because they have done a lot of improvements and also added many new features into this release.

Besides various bug fixes and making sure Fuse Fabric is much more stable. There are two major change in this version update:

New Tooling in JBoss Developer Studio (JBDS) 9.1 GA. Newer Apache Camel version – Camel v2.17. I was really impressed by the work put in to make developing Camel application much simpler. First is the installation of tooling itself. Now it has a all-in-one installer so you don't need to worry about which plugins you need to check. See the videos below to see the new "Getting Started" of Fuse 6.3.



And If you notice from the above video, the presentation of camel route in JBDS has also updated. It fixed some of the miss representation of logic and making it easier to read.

Old Camel Route
New Camel Route
On …

Fuse Integration Service - Setup JBDS and create first quickstart application

Before we go and start creating our first application, I want to show you how to setup your JBoss Developer Studio, create a small application from the quickstart example and then running it on Fuse Integration Service.

I am using JBoss Developer Studio version 9, you can find it here.
After download the

jboss-devstudio-9.0.0.GA-installer-eap.jar
double-click it, and start installing with default values.

After successful installation, we will need install the plugins for Fuse, on JBoss Central view, select software update, select enable early access.


And select JBoss Fuse Development for the plugin,


Click on install, and we are all set to go!

First thing first, we want to create a Fuse project to deploy on the base of Fuse Integration Service, which is OpenShift. If you have not installed it, please go back to my previous post for instructions. So on your JBDS, right click and start creating the project. Select new, maven project, if you have installed the plugin correctly, you should …