How to make a trigger wait itself end to run again Quartz C#

Viewed 1587

I'm using Quartz 2.5.0.0

And i have the following code to run any job i want. All my job's are staying in a folder, as i just take it there.

var scheduler = StdSchedulerFactory.GetDefaultScheduler();
scheduler.Start();

var t = new ImportingLib.Importer();
t.DoImport();

foreach (var component in t.CallAllComponents())
{   
    var job = JobBuilder.Create(component)
        .WithIdentity(component.Name)
        .Build();

    var trigger = TriggerBuilder.Create()
   .WithIdentity($"{component.Name}Trigger")
   .StartNow()
   .WithSimpleSchedule(x => x
       .WithIntervalInSeconds(10)
       .RepeatForever())
   .ForJob(component.Name)
   .Build();
    scheduler.ScheduleJob(job, trigger);
}

I want to make this job run every 10 seconds, but i have to wait itself end, just after this, start the same Job again. A way to know how when the tread ends should work, but i dont found how to make this. Any idea how can i make it work?

1 Answers
Related