java - making Quartz scheduler persistent without JDBC -
we're building app around mongodb, , have need run cron-like jobs periodically. i've used quartz before kind of thing when projects based around rdbms jdbc.
since we're using mongodb our main datastore in project, i'd prefer not introduce rdbms persist quartz jobs, there doesn't seem kind of jobstore implementatiom mongodb.
can recommend either way quartz mongodb, or simple alternative quartz? needs simple (run various java jobs manner of configuration, à la cron).
we run quartz spring , it's xml file jobs defined , cron expressions.
declare job in spring:
<bean name="myjob" class="org.springframework.scheduling.quartz.methodinvokingjobdetailfactorybean"> <property name="concurrent" value="false"/> <property name="targetbeanname" value="mybean"/> <property name="targetmethod" value="myscheduledmethod"/> </bean> <bean id="myjobtrigger" class="org.springframework.scheduling.quartz.crontriggerbean"> <property name="jobdetail" ref="myjob"/> <!-- every 30s --> <property name="cronexpression" value="0/30 * * * * ?"/> </bean>
quartz wiring:
<bean id="schedulerfactorybean" class="org.springframework.scheduling.quartz.schedulerfactorybean"> <property name="triggers"> <!-- list of batch jobs fed scheduler. --> <list> <ref bean="mytrigger"/> </list> </property> </bean>
run with:
import org.springframework.context.support.classpathxmlapplicationcontext; public class app { public static void main( string[] args ) throws exception { new classpathxmlapplicationcontext("jobs-context.xml"); } }
Comments
Post a Comment