tags:

views:

213

answers:

3

I would like to be able to create some directories after Mule has started, but before it starts any other services.

I started looking into notifications but I'm not sure if that is the right place to do it. I will need access to the spring beans so it would have to be after spring init, but before any of the connectors and other processes kick off.

http://www.mulesource.org/display/MULE2USER/Mule+Server+Notifications

Thanks.

+2  A: 

The mule lifecycle has several interfaces available that you could use to accomplish this.

http://www.mulesource.org/docs/site/2.2.1/apidocs/org/mule/api/lifecycle/Startable.html

.../Initialisable.html

Essentially, from what I understand, if you want something to happen when your mule instance starts you would implement startable. If you want something to happen when a specific mule component is initialized, then you would implement initialisable.

solidjb
+1  A: 

Also see http://blogs.mulesoft.org/start-me-oh-so-gently/

andrew
A: 

A really neat way of doing this is to create your own Custom Agent by implementing UMOAgent.

<!-- Enable Agents for Mule -->
<agents>
    <!-- The MyAgent provides a convenient place to perform one off actions at startup/shutdown -->
    <agent name="MyAgent" className="com.xxx.base.util.MyAgent" />

...

Agents have a start and Stop method which gets called by Mule, your implementing class can then add in any code you want.

See link for more info http://www.mulesoft.org/documentation/display/MULE2USER/Mule+Agents

Wiretap