My question is in title : “How to check if a RecurringJob exist using the Id”
I know, with your doc, that it’s possible to remove a reccuringJob using :
or even how to trigger it using :
But I can’t find a wat to check if a reccuringJob is in action.
Did I miss something ?
I was having same requirement and I find solution for this as below.
NOTE: This solution work only if you are using SQL server as JOB Storage.
To retrieve information regarding JOB action weather is it in action or not I use Below SQL query.
select * from Hash where Key like '%jobid%'
or you can use exact match
select * from Hash where Key = 'recurring-job:' + jobid
If this query return any record then job is in action, else it is not.
I was expecting that something like that would exist :
But using the database is a good idea too.
Yes, I was expecting that too, but I can’t find it.So I choose my way.
Might be hangfire team is too busy for this powerful product but they forget to add this simple feature.
However they have this thread so they will add this feature in their future release.
Hardocoding Sql, when Hangfire itself is storage agnostic is a bit counter intuitive . Better to use the existing Storage/Connection API.
Ie. you can use
GetAllEntriesFromHash("'recurring-job:' + jobid)