mirror of https://github.com/abpframework/abp.git
8 changed files with 137 additions and 52 deletions
@ -0,0 +1,48 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Specialized; |
||||
|
using System.Threading.Tasks; |
||||
|
using JetBrains.Annotations; |
||||
|
using Quartz; |
||||
|
|
||||
|
namespace Volo.Abp.Quartz |
||||
|
{ |
||||
|
public class AbpQuartzOptions |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// The quartz configuration. Available properties can be found within Quartz.Impl.StdSchedulerFactory.
|
||||
|
/// </summary>
|
||||
|
public NameValueCollection Properties { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// How long Quartz should wait before starting. Default: 0.
|
||||
|
/// </summary>
|
||||
|
public TimeSpan StartDelay { get; set; } |
||||
|
|
||||
|
[NotNull] |
||||
|
public Func<IScheduler, Task> StartSchedulerFactory |
||||
|
{ |
||||
|
get => _startSchedulerFactory; |
||||
|
set => _startSchedulerFactory = Check.NotNull(value, nameof(value)); |
||||
|
} |
||||
|
private Func<IScheduler, Task> _startSchedulerFactory; |
||||
|
|
||||
|
public AbpQuartzOptions() |
||||
|
{ |
||||
|
Properties = new NameValueCollection(); |
||||
|
StartDelay = new TimeSpan(0); |
||||
|
_startSchedulerFactory = StartSchedulerAsync; |
||||
|
} |
||||
|
|
||||
|
private async Task StartSchedulerAsync(IScheduler scheduler) |
||||
|
{ |
||||
|
if (StartDelay.Ticks > 0) |
||||
|
{ |
||||
|
await scheduler.StartDelayed(StartDelay); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
await scheduler.Start(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,23 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections.Specialized; |
|
||||
|
|
||||
namespace Volo.Abp.Quartz |
|
||||
{ |
|
||||
public class AbpQuartzPreOptions |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// The quartz configuration. Available properties can be found within Quartz.Impl.StdSchedulerFactory.
|
|
||||
/// </summary>
|
|
||||
public NameValueCollection Properties { get; set; } |
|
||||
/// <summary>
|
|
||||
/// How long Quartz should wait before starting. Default: 0.
|
|
||||
/// </summary>
|
|
||||
public TimeSpan StartDelay { get; set; } |
|
||||
|
|
||||
public AbpQuartzPreOptions() |
|
||||
{ |
|
||||
Properties = new NameValueCollection(); |
|
||||
StartDelay = new TimeSpan(0); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue