Tuesday, September 5, 2023

Convert An(y) Monolith Opensource git Project Into Hybrid Application using Digital Transform tool in less than 20 mins.

Automate Monolith to Hybrid Application

Quicker Digital Transformation

We are in the world of cloud, and applications have to be smart enough to support cloud computations. We often see Monolith applications around us.  Architects are tempted to rewrite the Monolith App into Microservices but we can now reuse the existing functionality of Monolith, which is tested, supports Testing. We can now scale that code without giving huge Time - Material - Efforts on conversion.

Using Digital Transform Tool

Miracle has formed A new Team specialized for Digital Transformation with identity "CodAGeeks". They have recently launched cloud based Tool for Digital Transformation. It is quick and works as Charm!

I will demonstrate the use of the tool and briefly explain its features here.
 
The Tool can be accessed at  http://codageeks.com/demo.html

You can request A token to execute the transformation by sending an email on support@codageeks.com
 

Selecting the Project to Transform

I visited http://www.github.com to select a widely used Monolith Application in Java, since the tool only supports Java code base as of now. I selected the project with below details.

  • url: https://github.com/hta218/StoreManager/
  • Monolith Functional Class to Transform:  src/Functions/pdf_Export.java
  • Libs folder: /lib
  • Libs used:  itextpdf-5.3.4.jar:jcalendar-1.4.jar:sqljdbc4-3.0.jar:jtds-1.3.1.jar
  • Binary Folder: /build/classes

Purpose: This class has most Efferent coupling with other classes in the project. It is been called to  converting the invoice to pdf. For an enterprise, this can be a use case to scale this class to support multiple requests across various departments.

End Result of the Transformation

  1. Rest Controller: You will see that pdf_Export.java is exposed through a controller class and the entire code is wrapped into a Thorntail Microservice Application. Hence You can now Horizontally  scale this code.

  2. Modified Monolith Code: Existing Monolith code is modified in such a way that You don't have to do any further customization. The new Monolith code will consume the new Rest end point without any manual intervention.

Executing the Digital Transformation Tool:

 I opened the tool url http://codageeks.com/demo.html in chrome browser. 







    I have received 3 tokens after mailing to support@codageeks.com

I gave below details in the input boxes:


 


    

 

    I am sharing the inputs below in Plain Text:

Git Project URL:"https://github.com/hta218/StoreManager/",
Git Project Branch:"master",
Project Folder Name:"StoreManager",
Project Source Path From Git Root: "src",
Project Binary Path From Git Root: "build/classes",
Filename of the class to Transform:"Functions",
Path of the class to Transform From Source Folder:"pdf_Export.java",   
Library Folder Path From Git Root:"/lib",
Libs in ':' separated list :"itextpdf-5.3.4.jar:jcalendar-1.4.jar:sqljdbc4-3.0.jar:jtds-1.3.1.jar:"


You can use your Digital Transformation Token and git credentials.

On successful Transformation, you will see a response with link to the new code for you to download:

 

 

Incase the tool is not able to Automate the transformation you can subscribe to the support plans.

Checking the modified Code

The downloaded zip file is having below folders:

1) Microservice : This is the Thorntail Application project folder. The REST Controller for the pdf_Export class is located at inside it, as shown below:



 

 

 2) Monolith/StoreManager : The existing pdf_Export.java class is modified to consume the Microservices. All the test cases are still valid as the class efferent coupling remains intact.






Executing the transformed code

You have to execute Microservice and the newMonolith application. There is no change in the way you execute the newMonolith as compared to StoreManager( Monolith)

Copy the Microservice and newMonolith Folders into same file system from where you executed Monolith application, earlier to the Digital Transformation.

  • Executing Microservice: Navigate to the Microservice/ThorntailDemo folder in conole applilcation, and issue the commnd mvn thorntail:run.

You have to manually copy your dependencies of Monolith Application to the Thorntail Demo. You will observe that Microservice Application is listening on port 8080 on your local machine.

  • Executing newMonolilth: Just execute it in the same way you did execute Monolith application. You will notice that your newMonolith Application is trying to connect to your local port 8080.

 

Additional Notes:

CodAGeeks provides support services to transform complex Monolith application in just 15 days !!!