骡子 - 如何在启动骡子(服务器监听器)运行代码

问题描述:

我正在读这篇文章骡子 - 如何在启动骡子(服务器监听器)运行代码

MULE lifecycle - how to hook into startup process

,但我不明白如何把XML的骡子-config.xml文件。我没有流量,入站端点和出站端点。我只需要一个启动和停止的类,我需要运行一些代码。这是什么骡XML?我找不到任何这样的例子。

感谢, 院长

试试这个:

<?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> 

(灵感上this