Friday, November 17, 2023

Monolith Class Bridge Pattern

Monolith Class Bridge Pattern

Monolith Class Bridge Pattern solves complexity involved in exposing a Monolith Java Class into Rest API. By using this pattern, you can easily execute the Monolith Code ( Methods ) as service end points. It ensures that "Wrapper Controller" is seamlessly able to call the methods of the sliced Monolith Java Class. This enables the request response of the remote calls. You can then realize all benefits of the cloud application for your same monolith code.

This is part of "Lift & Shift of Monolith " Group of Architecture Patterns.

Problems addressed

Below are the problems that you face when you want to expose a single Java Class from a Monolith App as Rest API.

  1. If you change the syntax ( Name or parameters) of methods of the Java class, it will break the consumer classes and you have to rewrite them as well.

  2. The formal data types of the parameters of the methods are not directly supported for Request / Response, as required by REST API best practicies.
       

 How we solve the Problems

  1. We implement "Wrapper Controller " Pattern. The REST Controller will have an unique end point, corresponding to each public method of the Java Monolith Class. This includes Getter and Setters as well as service methods ( Business Functions )

  2. We add "Monolith Class Bridge" Java class to the application. This class acts as a bridge for the conversion of datatype of request payload and response body to the datatypes matching to the method parameters and there return types.
     
  3. Monolith Class Bridge is linked to the "Wrapper Controller", hence all the upstream requests received by the "Wrapper Controller" are forwarded to Monolith Class Bridge, which delagtes the call to the actual Monolith Class and captures the result of the method being called.
     
  4. Monolith Class Bridge is then responsible of converting the result of the method call into the required Json string such that controller can send it back as the Response.

Monolith Class Bridge Architecture Pattern in Action

This pattern is used by Digital Transformation Tools. You can refer to below videos to understand how this pattern helps in Digital Transformation.


1) CodaGeeks Digital Transform Tool:
This Tool helps you to transform your Java Monolith Class into Microservice. This tool is also available as an service ( SAAS ). Refer http://www.codageeks.com for more details.

 
 
 
 
       2)  Miracle Open Transform:
     This is an Open Source project hosted on git hub. It has code which               implements this and other "Lift and Shift Monolith" group of patterns.






What is an Architectural Pattern?

According to Wikipedia,

An architectural pattern is a general, reusable solution to a commonly occurring problem in software architecture within a given context. Architectural patterns are similar to software design pattern but have a broader scope.

At Miracle Labs, we constantly innovate around real time problems and try to find solutions. While we were attempting early Digital Transformation Projects, we solved complex problems.










No comments:

Post a Comment