1
votes

I was reading this post

MULE lifecycle - how to hook into startup process

but I don't get how to put the xml in the mule-config.xml file. I don't have a flow, inbound endpoint nor outbound endpoint. I just have a class with a start and stop that I need to run some code on. What is the mule xml for this? I can't find any examples of this.

thanks, Dean

1

1 Answers

5
votes

Try this :

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:spring="http://www.springframework.org/schema/beans"
        xsi:schemaLocation="
                http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd">
        <spring:beans>
            <spring:bean id="initializer" class="org.myclass.that.implements.muleContextNotificationListener.MuleContextNotification"/>
        </spring:beans>

        <notifications>
            <notification event="CONTEXT"/>
            <notification-listener ref="initializer"/>
        </notifications>

    </mule>

(Inspired on this)