Search code examples
c#.nethangfirehangfire-sql

Query Hangfire via internal API or Db Context?


I wonder if there is an internal API or EF Context that i can use within hangfire? I would like to obtain a list of all the jobs that have failed, check the method they are for and then requeue them if they are for the method i require.

I would like to do this so that users can change the configuration of a job that has been queued but failed for whatever reason, and they can force it to run again.


Solution

  • You should try with a monitoring API object, obtained through :

    Hangfire.JobStorage.Current.GetMonitoringApi()
    

    and its FailedJobs(int from, int count) method