【问题标题】:How and where do I implement my recurring Hangfire job in the solution structure? Any sample apps?在解决方案结构中,我如何以及在何处实施我的循环 Hangfire 作业?任何示例应用程序?
【发布时间】:2019-12-31 12:18:43
【问题描述】:

我最近使用ABP Framework开始了我的第一个项目

我将其实现为a moduleno UI

我想将Hangfire 用于recurring tasks,以利用它附带的Hangfire UI/Dashboard

目前没有关于 Hangfire 集成的文档。 The documentation page is empty。我知道 ABP 相对较新,但我想有人已经正确实施了它。

到目前为止,我能找到的最好的是 Github 问题(其中一些仍然打开),用户正在尝试做同样的事情。

  1. Configuring Hangfire as Background Job Manager #2166
  2. Use Volo.Abp.Hangfire Module ERROR #1313

我还注意到 Hangfire 有两个 ABP Nuget 包:

  1. Volo.Abp.HangFire
  2. Volo.Abp.BackgroundJobs.HangFire

所以我的两个主要问题是:

  1. 按照 ABP 惯例,在我的 Name.Space.Domain 项目中实施 Hangfire 作业是否正确?
  2. 如何将其作为重复性工作实施?

同时,我会修补从我分享的链接中提取的内容,如果可行,我会很乐意分享我的解决方案。

【问题讨论】:

    标签: hangfire abp


    【解决方案1】:

    对于第一个问题,完全可以在领域层实现业务逻辑。因此Hangfire 可以处理一些业务逻辑。

    对于第二个问题,你可以在启动的Configure函数中添加这段代码:

    app.UseHangfireDashboard();
    app.UseHangfireServer();
    RecurringJob.AddOrUpdate<yourjobsclass>(x => x.yourJobFunction, Cron.MinuteInterval(5));
    

    以下是我认为可以提供帮助的一些资源:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-19
      • 1970-01-01
      • 1970-01-01
      • 2017-06-06
      • 1970-01-01
      相关资源
      最近更新 更多