Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to schedule a job in Quartz that repeats forever?

Is it possible to repeat a job in Quartz forever in a serial way?

Now, if I don't set RepeatInterval I get an error saying that RepeatInterval cannot be zero.

Is it possible to configure this using Spring.NET? What I have now is this:

<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net">
  <object id="ExampleBusinessObject" type="Edu3.Core.Job.ExampleJob, Edu3.Core"/>

  <object id="JobDetail" 
          type="Spring.Scheduling.Quartz.MethodInvokingJobDetailFactoryObject,
                Spring.Scheduling.Quartz">
    <property name="TargetObject" ref="ExampleBusinessObject" />
    <property name="TargetMethod" value="DoIt" />
    <property name="Concurrent" value="false" />
  </object>

  <object id="SimpleTrigger" 
          type="Spring.Scheduling.Quartz.SimpleTriggerObject, 
                Spring.Scheduling.Quartz">
    <!-- see the example of method invoking job above -->
    <property name="JobDetail" ref="JobDetail" />
    <!-- 10 seconds -->
    <!--<property name="StartDelay" value="5s" />-->
    <!-- repeat every 50 seconds -->
    <property name="RepeatInterval" value="10s" />
  </object>

  <object id="quartzSchedulerFactory" 
          type="Spring.Scheduling.Quartz.SchedulerFactoryObject,
                Spring.Scheduling.Quartz">
    <property name="triggers">
      <list>
        <ref object="SimpleTrigger" />
      </list>
    </property>
  </object>
</objects>

I don't want different threads executing the same job. I just want DoIt to be triggered. If DoIt is finished, then DoIt is triggered again. Like a infinitive while loop.

like image 510
Lieven Cardoen Avatar asked Feb 26 '23 09:02

Lieven Cardoen


1 Answers

'RepeatCount' set to '-1'

like image 70
Aito Avatar answered May 03 '23 04:05

Aito