Ch. 3 A Lightweight Micro-Service Architecture for Java

Ch. 8 of Modeling with the System Descriptor provides an introduction to micro-services, in general. In this chapter, we’ll explore a software framework written in Java that supports creating these types of applications.

Architectures for Systems

Our SoftwareStore system contains four sub-components (which are modeled as parts). We haven’t declared how this system is deployed and how the sub-components are realized, yet. Before we can do that, we need to explore some potential Architectures

Single Application

One architecture for the SoftwareStore system might involve deploying the system as a single application. In this architecture, the entire system runs as a single process on a single host. The sub-components might be implemented as individual classes. For example, a Java based application might implement each component as a Spring Bean, Guice POJO, or OSGi Declarative Service component dependency. This forms the simplest architecture and results in the least amount of flexibility. Note that as we add more components, the application will still run as a single app or process.

MSA

An alternative architecture might involve deploying the SoftwareStore system using micro-services. In this style of deployment, each sub-component is deployed as a separate micro-service application and process. This means that four processes must be executing together to form the behavior of the SoftwareStore. This also means that no single component represents the entire SoftwareStore system. All four services must be started and running for the system to be operational.

This provides several advantages as it allows different parts of the system to scale at different rates. It also allows each sub-component of the system to be independently managed, developed, and maintained.

This is the default architecture Jellyfish prefers. Jellyfish currently only generates for this style of architecture. However, it’s possible to extend Jellyfish with new commands that will generate an application using any desired architecture.

A Java MSA framework

In order to allow Jellyfish to generate code as simply as possible, the generated code makes heavy use of two infrastructure providers:

Both of these projects provide Java libraries which make it easier to develop modular micro-services. These projects use a framework called OSGi. This technology introduces a powerful modularity layer into Java. Jellyfish-generated micro-services run in an application stack that looks like this:

application stack

This stack uses Java, OSGi, BLoCS, and Starfish to form the runtime environment for these services.

When we deploy the SoftwareStore system, we’ll deploy four independent micro-service apps, each running within its own self-contained stack. The result would look something like this:

software-store-msa

Using BLoCS and Starfish with other types of architectures

Jellyfish only generates code for micro-service architectures.  The generated code makes heavy use of BLoCS and Starfish
infrastructure.  These projects can be used by any type of architecture, not just an MSA.  This means that much of
Starfish and BLoCS infrastructure can be used by any application.

Additional Resources

Consider reviewing the following resources before continuing. This provides an overview of OSGi and some BLoCS components.

The main documentation for BLoCS can be found at https://pages.github.ms.northgrum.com/BLoCS/blocs/docs.html.