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

随心笔谈1年前 (2023)发布 admin
184 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.”);
});
}
}

© 版权声明

相关文章