0

Probably a stupid question... but here goes anyway...

I would like to know if the quartz.net job will be active to run on the next iteration though there is an exception( which is handled) in the current iteration. Can anyone please explain me if my understanding is correct?

public void Execute(IJobExecutionContext context)
{
    _logProvider.Info("Started..");

    try
    {
        _service.Calculate();
    }
    catch (Exception ex)
    {
        _logProvider.Error("Error " + ex);
    }
}

Thanks

Mukil Deepthi
  • 6,072
  • 13
  • 71
  • 156

1 Answers1

2

The simple answer is: yes, it will execute on next iteration.

Actually this is related to general .NET exception handling, rather then quartz.net behaviour: if you have function that catches any exceptions - exceptions will not be visible outside of that function. In other words, code like

public void SomeMethod()
{
    try
    {
        //some logic that can generate exception
    }
    catch (Exception ex)
    {

    }
}

is the same as

public void SomeMethod()
{
    //some logic that NEVER generates the exception
}

In scope of quartz.net:

The only type of exception that you are allowed to throw from the execute method is JobExecutionException.

otherwise you will have unhandled exception in AppDomain. You can find more in Quartz.net Job unhandled exception behaviour SO question

Community
  • 1
  • 1
Set
  • 47,577
  • 22
  • 132
  • 150