I have scheduled a job with a string type unique custom job id myJobId as shown below:
string myJobId = “someUniqueId”;
RecurringJob.AddOrUpdate(myJobId, x => x.Execute(JobCancellationToken.Null), Cron.Daily);
Then trying to delete the job by using BackgroundJob.Delete method that requires string type input parameter jobId that actually should be a valid integer value. (if the job is currently processing).
So here need some Hangfire API to get the integer jobId, by referring the custom unique myJobId that was passed to RecurringJob.AddOrUpdate method while scheduling the job.
Please help.
Note: RecurringJob.RemoveIfExists(myJobId) only removes scheduled job but does not stop the job if the job is currently processing. i.e. the method call RecurringJob.RemoveIfExists does not passes IJobCancellationToken.