I have a mule plugin added as a dependency in my Project-A, In the mule-plugin I have defined a Transform Message where I am referring the values from the properties file defined in the plugin using p('property_name'). But it is throwing an error. Is it possible to define p() in the mule plugin and add the mule plugin as a dependency in a Project and expect it to work fine. If not is there any work around for it?
-
Hi Amer. Are you using the XML SDK to build the plugin? What about using the global connection properties with default values instead of puting a file with properties inside the plugin? – Jorge Garcia Nov 10 '20 at 15:20
-
Or are you packaging an application as a plugin to reuse configurations in another application? – aled Nov 10 '20 at 15:25
-
I am packaging an application as a plugin to reuse configurations in another application – Sufi Nov 10 '20 at 15:49
3 Answers
You can try the following dataweave construct to retrieve a property value in transformations:
%dw 2.0
output application/java
---
{
myPropValue: Mule::p("my.property.name")
}

- 1,296
- 7
- 8
-
I have a mule-plugin inside the plugin there is a transform message, In that transform message I am using p('property_name'), This 'property_name' is defined in the properties file of mule-plugin. Now I added this mule-plugin as a dependency to my Project-A. Now, when the control goes to the flows of the mule-plugin while I am debugging project-A, the p('property_name') is resolved to null. – Sufi Nov 10 '20 at 16:25
-
Could you try defining the property value in project-A and see if it resolves as expected? If it resolves correctly, then further analysis will be required to understand why the property is not being loaded from the plugin. One question: would it be possible to let the user set this property up via connector or at the operation level? – olamiral Nov 10 '20 at 17:03
Instead of using the property inside the Transform (DataWeave) operation, set a variable to the property before calling the transformation, using the property placeholder syntax (ie "${property.name}"
).
Even if that works, you should reconsider the design of the application. Using properties defined in the plugin could conflict with the application defined properties.

- 21,330
- 3
- 27
- 34
Funny thing - even Mule is kinda "interpretation" approach - it does it statically as soon as it process stuff.
Look at your logs how application is loaded and instantiated - you will see modules and flows and plugins loaded in some sequence. Mostly it is based on the alphabetical order of the Mule modules.
If module A uses properies which are defined inside module B - it will be null becuase when A is loaded B does not exist yet and so there are no properies at all.
In short - look to log as modules laded and rename the XML files if order is not right for you.

- 4,457
- 2
- 20
- 59