Mule ESB annotation doesn't work

点点圈 提交于 2019-12-11 15:00:18

问题


I try to use @Schedule Annotation in mule esb, but it does not work. I don't know what's wrong with it. My java code :

public class MyCache {

    @Schedule(interval=1000)
    public void writeStr(){

        Log.debug("111112222222223333333334444444444");
        System.out.println("111112222222223333333334444444444");
    }

}

回答1:


For a reason that goes beyond imagination, you have to use @Schedule annotated Java components in the obsolete model/service container for it to work.

Your above class (that I put in the com.acme package) works with the following on Mule 3.4.0:

<model>
    <service name="myCacheScheduler">
        <component>
            <singleton-object class="com.acme.MyCache" />
        </component>
    </service>
</model>


来源:https://stackoverflow.com/questions/17854025/mule-esb-annotation-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!