I’m new to using Hangfire so forgive me if this has been asked before.
I’m creating a background job via BackgroundJob.Schedule() to run at a specified time within my Windows service. The background job is scheduled when my service starts, however because jobs are persisted in Hangfire and the BackgroundJob.Schedule returns the job id I’m unable to determine if a scheduled job already exists nor can I remove any previous scheduled jobs when my service starts because I don’t know the id and BackgroundJob.Schedule doesn’t allow the id to be specified.
So my questions are:
How can I determine if a background job is scheduled when I don’t know the id?
How can I delete a background job or delete all background jobs when I don’t know the id?
Is there an in memory persistence that could be used instead as I create jobs when the service starts?
I did consider using a recurring job but I can’t get the schedule to work as I need a schedule that runs 2 days before the start of each month.
Thanks in advance
Steve