Issues When Checking if a job exist using Monitoring API

queues
Tags: #<Tag:0x00007f8ba0130d20>

#1

Hi,

I’m currently implementing to be used with Hangfire, I want to be able to check for the existance of a job, I’m currently creating the job using the following code:

RecurringJob.AddOrUpdate(HangfireJobName, () => DoWork(hangfireResources), cronExpression);

I’ve tried using the following code to get the job:

var monitoringApi = JobStorage.Current.GetMonitoringApi();
var queue = monitoringApi.ScheduledJobs(0, 10);

But this comes back empty, I’ve also replace the “var queue” line with the following:

var job = monitoringApi.JobDetails(HangfireJobName);

But this causes this exception:

Error converting data type nvarchar to bigint.

I’d just like to check the existance of a job (without going through the database).

Any help would be appreciated, thank you.


#2

Sorry to nudge an old topic, however, I was wondering if anyone had any insight as to the aforementioned issues above?