c# - HangFire Server Enable - Disable manually -
during development of hangfire application c# asp.net, , decided implement functionally admin can manage state of server, jobs.
- list item
server enable disable state. using enable button click event admin can start job server fire , forget , recurrent job can performed. , disable button stop activities of job.
- retrieve current state of server
i want retrieve current state of job server, can show server on or off.
- retrieve state , enable / disable state of jobs (only recurrent).
if want manage server/job created hangfire, can use monitoringapi or jobstorage there statuses.
sample codes :
var _jobstorage = jobstorage.current; // how recurringjobs using (var connection = _jobstorage.getconnection()) { var storageconnection = connection jobstorageconnection; if (storageconnection != null) { var recurringjob = storageconnection.getrecurringjobs(); foreach(var job in recurringjob) { // stuff } } } // how servers var monitoringapi = _jobstorage.getmonitoringapi(); var serverlist = monitoringapi.servers(); foreach( var server in serverlist) { // stuff server // can use var connection = _jobstorage.getconnection() // remove server }
from here can play around hangfire.
Comments
Post a Comment