LIGHT

  • News
  • Docs
  • Community
  • Reddit
  • GitHub

Integration Patterns

API Integration Pattern

While working with my clients to transform monolithic Java EE applications to microservices architecture, one of the most frequently asked questions from my clients is: “How do you integrate your newly built microservices with existing Java EE applications?” In other words: “How do you leverage existing application stacks when exposing REST APIs with microservices?”

Most organizations, especially financial institutions, have big Java EE applications running on Weblogic/Websphere that they’ve invested efforts in for a decade or longer. You cannot imagine that they can rewrite everything and switch to microservices overnight.

I have been working the following four different approaches over the last 5 years and I will give my recommendations based on my experience. Please be aware that this is just a generic recommendation and it cannot be applied to all use cases.

API Gateway

Most commercial API gateways offer the XML to JSON and JSON to XML transformation feature and this was a good selling point in early days. They promised that if you buy their product, the gateway will transform your XML based web services to JSON based RESTful APIs. The problem with this approach is performance, as all of them provide a generic transformer working with external defined mapping logic. The transformation is CPU intensive and with the overhead of gateway security and other layers, the throughput and latency are not acceptable. Also, there are other issues with commercial gateways as I documented in the gateway article.

Customized Transformation in API

Some developers and architects realized that buying a gateway cannot resolve the problem magically so they tried to build the transform logic into the API itself. The transformation code is customized per API and it is much more efficient than generic transformers in gateways. This provides a little bit more flexibility and slightly increased performance but it is not easy to write the transform code as most web services have very complicated request and response schemas. Performance wise, it is better than commercial gateway solutions but still very bad.

Calling service layer behind SOA or EMB

Most web services are built with multiple layers and chances are you have a service layer behind your web service tier with Java native APIs. In this case, we can bypass web services and call the native Java API (most likely session beans) from your RESTful APIs. This gives us a relatively good performance and leverages the most complicated services in the application tier. It is also a low cost solution to bring RESTful API on top of your existing applications.

The only drawback is that these app layers are deployed on Java EE platform and they have limited throughput and very hard to be scaled.

Calling Book of Record directly

In order to fully realize the benefits of microservices architecture, the existing monolithic application must be rewritten so that microservices can talk to the book of record directly. And this can be done during a long period of time to break up existing system to function areas and convert them one by one. Unlike the way Jave EE works to have different layers in designed, we need to cut the function vertically for microservices.

Summary

As described above, it is recommended to rewrite the existing monolithic app but if resources are constrained, then building microservices by calling existing services is acceptable. As microservices can be individually deployed and replaced, it is easy to convert them all to the final stage one by one.

See Also

  • Fail Fast vs Fail Slow
  • Eco System
  • CQRS
  • Event Sourcing
  • Service Mesh
  • About Light
    • Overview
    • Testimonials
    • What is Light
    • Features
    • Principles
    • Benefits
    • Roadmap
    • Community
    • Articles
    • Videos
    • License
    • Why Light Platform
  • Getting Started
    • Get Started Overview
    • Environment
    • Light Codegen Tool
    • Light Rest 4j
    • Light Tram 4j
    • Light Graphql 4j
    • Light Hybrid 4j
    • Light Eventuate 4j
    • Light Oauth2
    • Light Portal Service
    • Light Proxy Server
    • Light Router Server
    • Light Config Server
    • Light Saga 4j
    • Light Session 4j
    • Webserver
    • Websocket
    • Spring Boot Servlet
  • Architecture
    • Architecture Overview
    • API Category
    • API Gateway
    • Architecture Patterns
    • CQRS
    • Eco System
    • Event Sourcing
    • Fail Fast vs Fail Slow
    • Integration Patterns
    • JavaEE declining
    • Key Distribution
    • Microservices Architecture
    • Microservices Monitoring
    • Microservices Security
    • Microservices Traceability
    • Modular Monolith
    • Platform Ecosystem
    • Plugin Architecture
    • Scalability and Performance
    • Serverless
    • Service Collaboration
    • Service Mesh
    • SOA
    • Spring is bloated
    • Stages of API Adoption
    • Transaction Management
    • Microservices Cross-cutting Concerns Options
    • Service Mesh Plus
    • Service Discovery
  • Design
    • Design Overview
    • Design First vs Code First
    • Desgin Pattern
    • Service Evolution
    • Consumer Contract and Consumer Driven Contract
    • Handling Partial Failure
    • Idempotency
    • Server Life Cycle
    • Environment Segregation
    • Database
    • Decomposition Patterns
    • Http2
    • Test Driven
    • Multi-Tenancy
    • Why check token expiration
    • WebServices to Microservices
  • Cross-Cutting Concerns
    • Concerns Overview
  • API Styles
    • Light-4j for absolute performance
    • Style Overview
    • Distributed session on IMDG
    • Hybrid Serverless Modularized Monolithic
    • Kafka - Event Sourcing and CQRS
    • REST - Representational state transfer
    • Web Server with Light
    • Websocket with Light
    • Spring Boot Integration
    • Single Page Application
    • GraphQL - A query language for your API
    • Light IBM MQ
    • Light AWS Lambda
    • Chaos Monkey
  • Infrastructure Services
    • Service Overview
    • Light Proxy
    • Light Mesh
    • Light Router
    • Light Portal
    • Messaging Infrastructure
    • Centralized Logging
    • COVID-19
    • Light OAuth2
    • Metrics and Alerts
    • Config Server
    • Tokenization
    • Light Controller
  • Tool Chain
    • Tool Chain Overview
  • Utility Library
  • Service Consumer
    • Service Consumer
  • Development
    • Development Overview
  • Deployment
    • Deployment Overview
    • Frontend Backend
    • Linux Service
    • Windows Service
    • Install Eventuate on Windows
    • Secure API
    • Client vs light-router
    • Memory Limit
    • Deploy to Kubernetes
  • Benchmark
    • Benchmark Overview
  • Tutorial
    • Tutorial Overview
  • Troubleshooting
    • Troubleshoot
  • FAQ
    • FAQ Overview
  • Milestones
  • Contribute
    • Contribute to Light
    • Development
    • Documentation
    • Example
    • Tutorial
“Integration Patterns” was last updated: April 5, 2021: Issue246 (#256) (50b1c10)
Improve this page
  • News
  • Docs
  • Community
  • Reddit
  • GitHub
  • About Light
  • Getting Started
  • Architecture
  • Design
  • Cross-Cutting Concerns
  • API Styles
  • Infrastructure Services
  • Tool Chain
  • Utility Library
  • Service Consumer
  • Development
  • Deployment
  • Benchmark
  • Tutorial
  • Troubleshooting
  • FAQ
  • Milestones
  • Contribute