Generating starter code for microservices

You use the code generator to generate starter code to help with implementing the recommended partitions as microservices.

About this task

After you review or customize the partition recommendations, you can have IBM® Mono2Micro™ generate starter code that implements the wiring between classes across partitions to help accelerate the implementation and deployment of partitions without changing any monolith Java® code. To automatically generate the code, use the code generator component of Mono2Micro.

The code generator does the following:

  1. Creates transformational wrappings to turn methods that are called between partitions to Java webservice REST APIs to facilitate runtime calls between partitions.
  2. Creates a starter Dockerfile, a Liberty Maven plug-in enabled POM configuration file (pom.xml), and a server configuration file (server.xml) as part of code generation to accelerate the implementing and running of partitions on WebSphere® Liberty. See the generated READ_THIS_FIRST.MD file for more details.
    Tip: These files are generated for each partition. For the utility classes partition, the recommendation is to package it as a regular Java .jar module. Use the .jar module with other partitions whose classes depend on any of the utility classes.
  3. Provides the distributed object management, garbage collection, and remote local reference conversions similar to the Java remote method invocation mechanism.
  4. Provides guidance on what the developers should check and manually readjust in the generated code to develop and deploy the partitions eventually as microservices.

The first step circumvents common problems with converting monoliths to microservices: Classes that are defined in foreign components tend to get copied into all of the components along with all of their dependents. IBM Mono2Micro avoids this cascade copying process by creating API services for classes that are accessed from outside the partition. You then have efficient partitions to implement according to business logic seams or to your customizations.

Results

You have IBM Mono2Micro automatically generated the API services and related code to help you implement and run the partitions.