简体   繁体   English

使用ASP.NET核心进行动态计划

[英]Dynamic Scheduling with ASP.NET core

We want to create background job scheduling. 我们要创建后台作业调度。 Job may be vary by daily,on demand. 工作可能会根据需求每天变化。

Backgound job scheduling can be easily integrated by using HangFire,FluentScheduling library. 可以使用HangFire,FluentScheduling库轻松集成Backgound作业计划。

But all method for scheduling should be called dynamic, to send push notification to user of application. 但是所有调度方法都应称为动态方法,以向应用程序用户发送推送通知。

There will be one main Recuring job which is going to be fired on every 5 minutes and there are other child job should be created dynamically means one job for one notification. 每5分钟将触发一个主要的Recuring作业,并且应该动态创建其他子作业,这意味着一个作业需要一个通知。

RecurringJob.AddOrUpdate(() => Console.Write("Easy!"), Cron.Daily); RecurringJob.AddOrUpdate(()=> Console.Write(“ Easy!”),Cron.Daily); how can i get job id for this job and pass to other child job. 我如何获得该工作的工作ID并传递给其他子工作。

how can it will be achieved in asp.core ? 在asp.core中如何实现?

Just save the schedules (permanent) and the demands (temporary) somewhere (eg a database). 只需将日程表(永久性)和需求(临时性)保存在某个地方(例如数据库)。 Than schedule the background job to run every few seconds to check in the DB, if there is something to do. 比安排后台作业每隔几秒钟运行以检入数据库(如果有要做的话)。

You should also have a look into HostedServices in ASP.NET Core to run background tasks. 您还应该查看ASP.NET Core中的HostedServices来运行后台任务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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