Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Runtime-Patching in Mule 4

DZone 's Guide to

Runtime-Patching in Mule 4

Explore runtime-patching in Mule 4.

· Integration Zone ·
Free Resource

Patching in MUnit is different than how the Mule runtime is patched.

MUnit runs using the embedded container, which downloads all required dependencies to start a container based on a given version. 

Here we need to understand minMuleVersion config defined in your mule-artifact.json. It defines your minimum runtime that is supported to run your Mule app and your Mule munit.

Image title

<properties>
<app.runtime>4.2.0</app.runtime> -- Mule App Runtime
</properties>
<plugin>
    <groupId>com.mulesoft.munit.tools</groupId>
    <artifactId>munit-maven-plugin</artifactId>
    <version>${munit.version}</version>
    <executions>
        <execution>
            <id>test</id>
            <phase>test</phase>
            <goals>
                <goal>test</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
      <runtimeVersion>4.1.5</runtimeVersion> -- Munit Runtime
    </configuration>
</plugin>

You can switch your runtime (app/munit) anytime, but it should not be lower than minMuleVersion defined in your mule-artifact.json file. 

By default, MUnit runs in the studio with the version of the project’s server. You can override this version by specifying the patched runtime version in the MUnit run configuration:

Menu-->Run --> Run Configurations

Under MUnit, select your MUnit test file.

Type the MUnit patched version you want to use in the Mule Runtime Version field, under Advanced Settings or here you can reload from plugin added to your pom.

Image title

Below is the error if you define your minMuleVersion to 4.2.0 and you are trying to deploy your code in 4.1.5 

org.mule.runtime.api.exception.MuleRuntimeException: Artifact hello requires the newest runtime version. Artifact required version is 4.2.0 and Mule Runtime version is 4.1.5

INFO 2019-07-30 20:59:10,367 [WrapperListener_start_runner] org.mule.runtime.module.deployment.internal.StartupSummaryDeploymentListener: 
**********************************************************************
* - - + DOMAIN + - - * - - + STATUS + - - *
**********************************************************************
* default * DEPLOYED *
**********************************************************************

*******************************************************************************************************
* - - + APPLICATION + - - * - - + DOMAIN + - - * - - + STATUS + - - *
*******************************************************************************************************
* hello * UNKNOWN * FAILED *
*******************************************************************************************************
Topics:
mule 4 ,munit ,esb ,integration ,tutorial

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}