问题
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