views:

37

answers:

1

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"&gt;
  <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.

A: 

'RepeatCount' set to '-1'

Aito
I get an error:[Spring.Core.TypeMismatchException: Cannot convert property value of type [System.String] to required type [System.TimeSpan] for property 'RepeatInterval'., Inner Exception: System.ArgumentException: Repeat interval must be >= 0 at Quartz.SimpleTrigger.set_RepeatInterval(TimeSpan value) at _dynamic_Quartz.SimpleTrigger.set_RepeatInterval(Object , Object , Object[] )
Lieven Cardoen
If I do not set it at all, I get the error saying it can't be zero.
Lieven Cardoen
Ok, I see what you mean. But...if you need only an infinite loop (and not schedule anything) I don't see why you want to use Quartz. Just use a while loop.If you want to repeat the cycle for ever try to use both properties: RepeatInterval (<> 0) and RepeatCount (-1). I hope it helps you..
Aito
Indeed, a while loop would be better.
Lieven Cardoen
Lieven Cardoen