简体   繁体   中英

ASP.NET MVC Hangfire Get Collection of Jobs with details

我在ASP.NET应用程序中使用Hangfire在后台执行methodos,但是我需要创建自己的进程监视器,因此需要获取(选择)作业集合,并按日期,状态等进行过滤。 。 我怎样才能做到这一点?

Use Hangfire JobStorage

var recurringJobs = Hangfire.JobStorage.Current.GetConnection().GetRecurringJobs();

You can use this to return from a controller.

public ActionResult Index()
        {
            var recurringJobs = Hangfire.JobStorage.Current.GetConnection().GetRecurringJobs();
            return View(recurringJobs);
        }

Then create your view (Right Click on Index > Add View). This will show the list of views.

Now you can write your script to sort/filter.

Did you try to get jobs from database? Hangfire can store them if you configure it in your Startup class.

select * from [HangFire].[Job]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM