Cosmin Vană
Cosmin Vană

Reputation: 1592

Quartz.Net TriggerJob and wait for execution

I need to manually invoke some Quartz.NET jobs and wait for them to complete. Please see the simplified sample code below:

[HttpPost("[action]/{jobKey}")]
public async Task<IActionResult> StartJob(string jobKey)
{
    await _schedulerService.Scheduler.TriggerJob(new Quartz.JobKey(jobKey)); 
    return Ok();
}

However, using TriggerJob will not wait also for the execution of the job itself to complete. Is it possible to achieve this using Quartz.NET? I am using it on .NET Core, with the following package:

 <PackageReference Include="Quartz" Version="3.0.7" />

Upvotes: 5

Views: 510

Answers (0)

Related Questions