hangfire

.NET Core下开源任务调度框架Hangfire的Api任务拓展(支持秒级任务)

匿名 (未验证) 提交于 2019-12-02 22:06:11
HangFire的拓展和使用 看了很多博客,小白第一次写博客。 最近由于之前的任务调度框架总出现问题,因此想寻找一个替代品,之前使用的是Quartz.Net,这个框架方便之处就是支持cron表达式适合复杂日期场景使用,以及秒级任务。但是配置比较复杂,而且管理不方便,自己开发了个web管理页面,不过这个需要额外的单独线程去统一管理工作状态,很容易出现问题。 有考虑过 “FluentScheduler” ,使用简单,但是管理配置也很麻烦,我希望能做到配置简单,管理方便,高性能。最后想到了以前听过的hangfire,它的好处就是自带控制面板,在园子里看了很多相关资料,偶然发现了有人拓展过 hangfire 通过调用api接口来执行任务,这种方式可以避免依赖本地代码,方便部署,在此基础上,我用空闲时间拓展了一下现在已经基本可以满足需求。 所拓展的功能全部属于外部拓展,因此hangfire版本可以一直更新,现在已经更新最新版,支持秒级任务 gitHub地址 由于更新到最新版hangfire 1.7支持秒级任务,使用的在线表达式生成部分表达式有问题,注掉了秒级任务表达式生成,有时间需要详细测试更改,可以参考( hangfire官方提供的表达式 ) 现在已经实现的功能有: 1, 部署及调试 :只需要配置数据库连接,然后编译即可运行,无需建表,支持(redis,mysql, sqlserver

Hangfire VB Startup Throws SQL Exception

谁说胖子不能爱 提交于 2019-12-02 13:21:43
问题 See this StackOverflow question for some background. Hangfire looks like the right solution for me but I'm having trouble getting it to work. My development environment is VB 2010 with SQL 2005. Not the latest tools! Public Sub Configuration(app As IAppBuilder) Dim act = Sub(config As IBootstrapperConfiguration) config.UseSqlServerStorage("HangfireDb") config.UseServer() End Sub app.UseHangfire(act) End Sub I borrowed the code from the article above which translates the original C# code to VB

Hangfire and VB.NET - Gettings things configured in the Application Startup class

三世轮回 提交于 2019-12-02 07:09:28
问题 Earlier this week I ran across Scott Hanselman's post about background processing in ASP.NET (http://www.hanselman.com/blog/HowToRunBackgroundTasksInASPNET.aspx). I've written routines in the past that automatically hits a page every so often to run some tasks, but this background processing idea is something I never even considered, and Hangfire (http://hangfire.io/) looks perfect for my background processing needs (mainly sending emails). To get HangFire going (after installing it via NuGet

Hangfire VB Startup Throws SQL Exception

大兔子大兔子 提交于 2019-12-02 06:40:29
See this StackOverflow question for some background. Hangfire looks like the right solution for me but I'm having trouble getting it to work. My development environment is VB 2010 with SQL 2005. Not the latest tools! Public Sub Configuration(app As IAppBuilder) Dim act = Sub(config As IBootstrapperConfiguration) config.UseSqlServerStorage("HangfireDb") config.UseServer() End Sub app.UseHangfire(act) End Sub I borrowed the code from the article above which translates the original C# code to VB. Evidently, this code works but when I run it, it throws a SQLException error with the message "Column

How to resolve type using ServiceStack Funq IoC

孤人 提交于 2019-12-02 03:16:27
问题 I'm trying to write a JobActivator for HangFire using ServiceStack IoC and I'm having trouble resolving from a type. I'm sure this will be an easy answer for someone with more experience with generics. The container I'm passing in is coming from HostContext.Container using Hangfire; using System; using System.Collections.Generic; using System.Linq; using ServiceStack; namespace Common.Hangfire { public class FunqJobActivator : JobActivator { private Funq.Container _container; public

How to resolve type using ServiceStack Funq IoC

╄→гoц情女王★ 提交于 2019-12-02 02:31:44
I'm trying to write a JobActivator for HangFire using ServiceStack IoC and I'm having trouble resolving from a type. I'm sure this will be an easy answer for someone with more experience with generics. The container I'm passing in is coming from HostContext.Container using Hangfire; using System; using System.Collections.Generic; using System.Linq; using ServiceStack; namespace Common.Hangfire { public class FunqJobActivator : JobActivator { private Funq.Container _container; public FunqJobActivator(Funq.Container container) { if (container == null) { throw new ArgumentNullException("container

Hangfire and VB.NET - Gettings things configured in the Application Startup class

北慕城南 提交于 2019-12-01 23:45:11
Earlier this week I ran across Scott Hanselman's post about background processing in ASP.NET ( http://www.hanselman.com/blog/HowToRunBackgroundTasksInASPNET.aspx ). I've written routines in the past that automatically hits a page every so often to run some tasks, but this background processing idea is something I never even considered, and Hangfire ( http://hangfire.io/ ) looks perfect for my background processing needs (mainly sending emails). To get HangFire going (after installing it via NuGet) I need to get it started up in the Application Startup class. The documentation provides C# code

HangFire recurring task data

瘦欲@ 提交于 2019-12-01 20:41:34
问题 I am coding a MVC 5 internet application and am using HangFire for recurring tasks. If I have a Monthly recurring task, how can I get the value of the next execution time? Here is my code for the recurring task: RecurringJob.AddOrUpdate("AccountMonthlyActionExtendPaymentSubscription", () => accountService.AccountMonthlyActionExtendPaymentSubscription(), Cron.Monthly); I can retrieve the job data as follows: using (var connection = JobStorage.Current.GetConnection()) { var recurringJob =

hangfire recurring job on every server

穿精又带淫゛_ 提交于 2019-12-01 07:31:00
I have a situation where I need a recurring job registered with hangfire to run on every server in the cluster. (The job is to copy some files locally so needs to run on every server regularly) So far I have tried registering the same job with an id of the server name resulting in n job for n servers: RecurringJob.AddOrUpdate(Environment.MachineName, () => CopyFiles(Environment.MachineName), Cron.MinuteInterval(_delay)); and the job itself checks if it is the correct server and only does something if it is: public static void CopyFiles(string taskId) { if (string.IsNullOrWhiteSpace(taskId) ||

hangfire recurring job on every server

邮差的信 提交于 2019-12-01 04:19:33
问题 I have a situation where I need a recurring job registered with hangfire to run on every server in the cluster. (The job is to copy some files locally so needs to run on every server regularly) So far I have tried registering the same job with an id of the server name resulting in n job for n servers: RecurringJob.AddOrUpdate(Environment.MachineName, () => CopyFiles(Environment.MachineName), Cron.MinuteInterval(_delay)); and the job itself checks if it is the correct server and only does