MuleSoft: Do You Have an Extra Mule Under the Hood?

A while ago, I was involved in a project which was the creation of new features for an existing system. In the evening, we clarified requirements with stakeholders about what needed to be implemented for that new undertaking. The following morning, I received an impatient call from one of the stakeholders asking when we would deliver such valuable functionality.

Nowadays, being competitive for a company means adapting to new realities and embracing new business opportunities at high speed. As a result, the most frequently asked question from businesses is how quickly you can deliver it.

Microservice architecture offers enormous benefits, whose main key feature is to deliver a requested change faster and without fear.

A Traditional Approach

There are many ways to structure your MuleSoft application, but I would like to show one I like the most. It is handy when you need to separate a logic in the future and, in other words, keep it under the hood until an actual need emerges.

Let’s look at the traditional way of designing the application. By traditional, I mean a straightforward approach where all related logic and functionality reside in a single application. This approach is simple and easy to start off, especially when, as a designer, you do not have a holistic view of how an application will play out later. 

This traditional approach usually looks like this:

Traditional approach

With peace in mind (vCore=0.1).

There are certainly some other ways to depict it:

Client, application, and DB

Or as a MuleSoft application:

Mulesoft application

The Pros and Cons of This Approach

Pros

Cons

A Separation of Concerns Approach

My favorite approach would look like the one below when we group functionality logically by applying some rules: 

Taking and applying these simple rules helps us to turn our traditional application into such a picture:

A Separation of concern approach This is when you are hiding an extra mule under the hood but not using it immediately.

Please remember not to call functions (flows/subflow) in the "operations" group from inside the "search" group and vice versa. If you need this, you can just create a separate group for the shared functionality or externalize it by adding a dependency to the POM file.

You can go ahead and deploy it. If you need to scale it up in the future, then you can create a new application from it simply. The initial structure can be split or extracted from the original application without fear of breaking it.

This is a picture of the new approach:  

The new approach

There are certainly some other ways to depict this:

Client, application and DBs replicas

vCores = 1 (10 x 0.1 vCore) for read + 0.1 for write operations

Or as a MuleSoft application: 

Mulesoft application

You pulled out the extra mule and scaled it up as a new application, which was a fast and painless process.

Other use cases

In real life, we can have various scenarios when  a single application contains multiple responsibilities under the hood, such as:

Conclusion

Usually, at the project's beginning, you have a vague idea of how an application will play out in the near future. Still, applying this principle (separation of concerns principle) to some key functionality aspects will help you hedge against painful future changes or make them gracefully and without fear of breaking an original application. 

Easy work and simply done. :)

 

 

 

 

Top