I am using the spring Task Execution and scheduling framework. I would like to setup one scheduler in my application-context.xml:
I have a couple of JARs (one.jar, two.jar) that are deployed in my WAR that are going to wire to the scheduler. I would like to make the existence of the JARs setup the scheduled tasks for my scheduler. I.E. if I one deploy one.jar then I only want the timers to fire for that jar.Code:<task:scheduler id="scheduler" pool-size="10"/>
I can use the @Scheduled annotation to accomplish this, but then the problem is that my timer fire values are hard coded in the code.
Is there any way that I can put config in each jar
jar.one
-- > one-scheduler.xml
two.jarCode:<task:scheduled-tasks scheduler="myScheduler"> <task:scheduled ref="oneObject" method="someMethod" fixed-delay="5000"/> </task:scheduled-tasks>
-- > two-scheduler.xml
Such that spring will pick up on the fact that a jar is deployed and read its .xml file to setup the scheduled tasks?Code:<task:scheduled-tasks scheduler="myScheduler"> <task:scheduled ref="twoObject" method="someMethod" fixed-delay="10000"/> </task:scheduled-tasks>
I think that I can 'import' those files but that is not dynamic.
I like the idea of xml files as at build time I can run substitution to make my timers a little more configurable at build time.
Thanks.Code:<task:scheduled-tasks scheduler="myScheduler"> <task:scheduled ref="twoObject" method="someMethod" fixed-delay="${some.property.value}"/> </task:scheduled-tasks>


Reply With Quote