Dotnet 中的作业调度程序 [已关闭]

问题描述 投票:0回答:1

我需要关于使用以下技术堆栈为我们自己的作业调度程序创建 POC 的工具的想法或建议,这应该将本地 AutoSys 替换为基于云的解决方案。

技术堆栈:

  • 角度
  • C#、.NET 8.0
  • Azure PaaS(例如:逻辑应用程序、函数 appm...)
  • PostgreSQL / SQL Server

POC范围:

  • 能够在 UI 上配置、监控作业状态
  • 能够在 UI 上安排准时和重复的工作
  • 能够在一次性作业和重复作业的预定时间触发远程API。

现有环境中已经存在本地 AutoSys Enterprise Scheduler,但我们不会在这里创建完整的 AutoSys。但是,我们当然可以实现它。 Azure 云服务可以帮助我们实施经济高效的解决方案,涵盖我们产品组合中的一些用例。

c# .net-core cron azure-webjobs job-scheduling
1个回答
1
投票

我们可以尝试使用

Quartz.Net

https://www.quartz-scheduler.org/documentation/

// you can have base properties
var properties = new NameValueCollection();

// and override values via builder
IScheduler scheduler = await SchedulerBuilder.Create(properties)
    // default max concurrency is 10
    .UseDefaultThreadPool(x => x.MaxConcurrency = 5)
    // this is the default
    // .WithMisfireThreshold(TimeSpan.FromSeconds(60))
    .UsePersistentStore(x =>
    {
        // force job data map values to be considered as strings
        // prevents nasty surprises if object is accidentally serialized and then
        // serialization format breaks, defaults to false
        x.UseProperties = true;
        x.UseClustering();
        // there are other SQL providers supported too
        x.UseSqlServer("my connection string");
        // this requires Quartz.Serialization.SystemTextJson NuGet package
        x.UseSystemTextJsonSerializer();
    })
    // job initialization plugin handles our xml reading, without it defaults are used
    // requires Quartz.Plugins NuGet package
    .UseXmlSchedulingConfiguration(x =>
    {
        x.Files = new[] { "~/quartz_jobs.xml" };
        // this is the default
        x.FailOnFileNotFound = true;
        // this is not the default
        x.FailOnSchedulingError = true;
    })
    .BuildScheduler();

await scheduler.Start();
© www.soinside.com 2019 - 2024. All rights reserved.