.NET6+Quartz实现定时任务的示例详解(c#任务调度框架)没想到

随心笔谈2年前发布 编辑
209 0
🌐 经济型:买域名、轻量云服务器、用途:游戏 网站等 《腾讯云》特点:特价机便宜 适合初学者用 点我优惠购买
🚀 拓展型:买域名、轻量云服务器、用途:游戏 网站等 《阿里云》特点:中档服务器便宜 域名备案事多 点我优惠购买
🛡️ 稳定型:买域名、轻量云服务器、用途:游戏 网站等 《西部数码》 特点:比上两家略贵但是稳定性超好事也少 点我优惠购买

public class TestSchedulerListener : ISchedulerListener
{
public Task JobAdded(IJobDetail jobDetail, CancellationToken cancellationToken=default)
{
return Task.Run(()=> {
Console.WriteLine(“Test Job is added.”);
});
}

public Task JobDeleted(JobKey jobKey, CancellationToken cancellationToken=default)
{
return Task.Run(()=> {
Console.WriteLine(“Test Job is deleted.”);
});
}

public Task JobInterrupted(JobKey jobKey, CancellationToken cancellationToken=default)
{
return Task.Run(()=> {
Console.WriteLine(“Test Job is Interrupted.”);
});
}

public Task JobPaused(JobKey jobKey, CancellationToken cancellationToken=default)
{
return Task.Run(()=> {
Console.WriteLine(“Test Job is paused.”);
});
}

public Task JobResumed(JobKey jobKey, CancellationToken cancellationToken=default)
{
return Task.Run(()=> {
Console.WriteLine(“Test Job is resumed.”);
});
}

public Task JobScheduled(ITrigger trigger, CancellationToken cancellationToken=default)
{
return Task.Run(()=> {
Console.WriteLine(“Test Job is scheduled.”);
});
}

public Task JobsPaused(string jobGroup, CancellationToken cancellationToken=default)
{
return Task.Run(()=> {
Console.WriteLine(“Test Jobs is paused.”);
});
}

public Task JobsResumed(string jobGroup, CancellationToken cancellationToken=default)
{
return Task.Run(()=> {
Console.WriteLine(“Test Jobs is resumed.”);
});
}

public Task JobUnscheduled(TriggerKey triggerKey, CancellationToken cancellationToken=default)
{
return Task.Run(()=> {
Console.WriteLine(“Test Jobs is un schedulered.”);
});
}

public Task SchedulerError(string msg, SchedulerException cause, CancellationToken cancellationToken=default)
{
return Task.Run(()=> {
Console.WriteLine(“Test scheduler is error.”);
});
}

public Task SchedulerInStandbyMode(CancellationToken cancellationToken=default)
{
return Task.Run(()=> {
Console.WriteLine(“Test scheduler is standby mode.”);
});
}

public Task SchedulerShutdown(CancellationToken cancellationToken=default)
{
return Task.Run(()=> {
Console.WriteLine(“Test scheduler is shut down.”);
});
}

public Task SchedulerShuttingdown(CancellationToken cancellationToken=default)
{
return Task.Run(()=> {
Console.WriteLine(“Test scheduler is shutting down.”);
});
}

public Task SchedulerStarted(CancellationToken cancellationToken=default)
{
return Task.Run(()=> {
Console.WriteLine(“Test scheduleer is started.”);
});
}

public Task SchedulerStarting(CancellationToken cancellationToken=default)
{
return Task.Run(()=> {
Console.WriteLine(“Test scheduler is starting.”);
});
}

public Task SchedulingDataCleared(CancellationToken cancellationToken=default)
{
return Task.Run(()=> {
Console.WriteLine(“Test scheduling is cleared.”);
});
}

public Task TriggerFinalized(ITrigger trigger, CancellationToken cancellationToken=default)
{
return Task.Run(()=> {
Console.WriteLine(“Test trigger is finalized.”);
});
}

public Task TriggerPaused(TriggerKey triggerKey, CancellationToken cancellationToken=default)
{
return Task.Run(()=> {
Console.WriteLine(“Test trigger is paused.”);
});
}

public Task TriggerResumed(TriggerKey triggerKey, CancellationToken cancellationToken=default)
{
return Task.Run(()=> {
Console.WriteLine(“Test trigger is resumed.”);
});
}

public Task TriggersPaused(string? triggerGroup, CancellationToken cancellationToken=default)
{
return Task.Run(()=> {
Console.WriteLine(“Test triggers is paused.”);
});
}

public Task TriggersResumed(string? triggerGroup, CancellationToken cancellationToken=default)
{
return Task.Run(()=> {
Console.WriteLine(“Test triggers is resumed.”);
});
}
}

© 版权声明

相关文章