Reload Mule App Properties without Restarting or RedeployingApp

This is something which I liked, as we had the requirement (not discussing the requirement here) where in Admin Team will change the Mule Properties file, and Running Application should be able to pick this up at Runtime.

Basic Idea here is, to load property from Spring Bean, as all the SpringBeans will be available in Mule Registry, so if we need to reload, at regular time (Poll Mechanism) we should be able to read the same Spring Bean and update the Mule Registry.

Step 1: Define Spring Bean

<spring:bean id=“PropertyFileReader” name=“PropertyFileReader” class=“com.util.PropertyFileReader” scope=“singleton”/>

Step 2:

Java Code to Read Properties file

Step 3:

Poll Component to poll at regualar intervals, this flow will invoke the Java Class defined in Step 2.

New Java Component will call Java Class defined in Step 2, and will set it in registry.

This is it !!!

Only thing we need to understand is how Mule handles Spring in Mule Registry, so basically we are just playing with the Bean already registered in Mule Registry.

Leave a comment