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

Dea*_*ler 1 mule

我正在读这篇文章

MULE生命周期 - 如何挂钩启动过程

但我不知道如何将xml放在mule-config.xml文件中.我没有流,入站端点或出站端点.我只是有一个启动和停止的类,我需要运行一些代码.什么是mule xml?我找不到任何这方面的例子.

谢谢,迪恩

Víc*_*ero 5

试试这个 :

<?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>
Run Code Online (Sandbox Code Playgroud)

(灵感来自)