user2714010
user2714010

Reputation: 535

Reading mule config from database

Is it possible to read mule configuration file path (file endpoints), smtp host /user/password (smtp endpoints) from database.We finally want to provide a User Interface , where the user can edit the properties through the screen.The normal properties file approach (key/Value) pairs was used earlier but needs to change to read these properties from the database.Any help on this will be greatly appreciated.

Upvotes: 0

Views: 451

Answers (1)

Seba
Seba

Reputation: 2319

Yes, you can use a custom properties provider.

Its configuration would look like this:

<spring:bean class="org.mule.DatabasePropertiesProvider" id="DatabasePropertiesProvider"/>

<spring:bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <spring:property name="properties">
        <spring:bean factory-bean="DatabasePropertiesProvider" factory-method="getProperties" />
    </spring:property>
</spring:bean>    

And the code for DatabasePropertiesProvider is as simple as this:

public class DatabasePropertiesProvider {
    public Properties getProperties() throws Exception {
        Properties properties = new Properties();
        // get properties from the database
        return properties;
    }
}

Upvotes: 2

Related Questions