Mateusz Lubanski
Mateusz Lubanski

Reputation: 71

How to tackle compile time constants in microservice word?

Some time ago we modularized our monolith into many small components. Each of them is stored in dedicated git repository and is versioned/released independently by different teams

We run into the problem that we have defined in many places public static final constants which are used by other modules. It means when you build dependent module it will compile constant value into its byte code

Our module software packages are delivered to customer which has running Production (last stable milestone) and Quality (newly implemented features which needs to be tested before they go on production) environments

To simplify and illustrate the problem let's say we have below modules delivered and running on Production environment

| Module | version | 
| A      | 1.1.0   |
| B      | 1.2.0   |
| Common | 1.0.0   |

We have defined a public staic final constants in Common module and both A and B are using them

In current sprint we modified module A and Common (we are updating one of the constants in it). Module A and common were recompiled and released, so customer would receive package installer:

| Module | version | 
| A      | 1.2.0   |
| B      | 1.2.0   |
| Common | 1.1.0   |

This will lead to problem that module B has compiled in bytecode old value of the constant which was updated in last sprint

If we decide to recompile as well module B:

Am I tackling this problem from wrong side as non of the solutions seems 100% solve the problem or would require lot of effort to achieve it?

Thanks in advance for any suggestions

Upvotes: 2

Views: 75

Answers (0)

Related Questions