info@yenlo.com
eng
Menu
WSO2 Enterprise Integrator 3 min

WSO2 Enterprise Integrator platform independent CAR files – Part 1

sidharth
Sidharth Dash
Integration Specialist
yenlo blog 2020 04 09 wso2 ei platform independent car files 600x350

WSO2 Enterprise Integrator platform independent CAR files – Part 1 Developing artifacts for WSO2 ESB is made easier by Developer Studio. As most of you may know, the Developer Studio provides a Maven-based project to develop ESB artifacts. Maven is a powerful tool for building and packaging application code. Among various things like dependencies and artifacts, one of the simpler yet powerful things provided by Maven is building profiles.

The current state

In a classic IT project, there is more than one environment; development, test, quality assurance (QA), and production. Each environment also has different endpoints to connect to, as shown in the snippet below.

yenlo_blog_2020-04-09_wso2-ei-platform-independent-car-files_figure-1

These endpoints can be inserted in Maven’s build profile and can be replaced during build.

For an instance the below is an endpoint in Developer Studio.

<endpoint name="app-server-ep" >

    <http method="get" uri-template="https://${app-server-host}/app"/>

    <description>app-server EP</description>

</endpoint>

After a build using Maven development profile (mvn clean install -P dev ) it looks like this:

<endpoint name="app-server-ep" >

    <http method="get" uri-template="https://app-d.server.host/app"/>

    <description>app-server EP</description>

</endpoint>

Limitations

Although profile-based development solves many issues, it’s not without limitations. Some are listed below:

  • 1. Before deployment, build in each environment:
    Profile-based development makes it mandatory to build the artifact before deploying it to each environment. For example, after an artifact has been tested in QA and verified as OK ,we still can’t use the verified artifact in production. Instead we have to build it again and this new artifact is “supposed” to work on production (as it’s based on the exact same source code state).
  • 2. No centralized configuration management (think: Spring Cloud configuration management):
    Although we can define environment-based variables in the Maven profile you’re far from a centralized configuration management solution. Each project has its own configuration and when the number of projects increases so does the duplicates. Also consider the workload if one endpoint changes unexpectedly.
  • 3. Static configuration:
    Maven profile is nothing but fancy text replacement. So if an endpoint changes in any environment, we have to build and deploy our artifact even though there are no functional changes.
  • 4. More prone to developer typos that lead to errors:
    Last but not least errors due to the person between keyboard and chair. We have all been in situations where there is a rush to go to Production. After the QA is tested OK and we are ready to go to production, it could happen that the developer forgets to update the production profile. Unfortunately, this cannot be deducted until we have deployed in production and things start to fall apart.

Environment Independent CAR file For Rescue

If we could manage environment-based variables such as app-server-host outside the ESB artifact and can fetch them at run time then we could have an environment independent CAR file. We used the ESB Registry property feature where you can store key-value pairs.

Following is the example of Registry property:

yenlo_blog_2020-04-09_wso2-ei-platform-independent-car-files_figure-2

Above are just the demo entries, but you can imagine that we can add entries such as endpoints, file share location etc. These values can be populated by calling Admin Services from any Configuration Management tool.

We can fetch these properties in WSO2 Enterprise Integrator as shown below:

<property name="uri.var.app-server-host" expression="get-

property('registry', 'gov:/com/test/esb/config@app-server-host')"

/>

<endpoint name="app-server-ep"

    >

    <http method="get" uri-template="https://{uri.var.app-server-host}/app" />

    <description>app-server EP</description>

</endpoint>,

WSO2 Enterprise Integrator will replace the app-server-host with the value from your registry. Excellent! Although we’ve made the Enterprise Integrator endpoint platform agnostic, there are other WSO2 Enterprise Integrator elements which need to be handled such as Data Services, VFS and inbound endpoints. For those, please tune in to the second part of the blog.

eng
Close