xxl-job的dotnet core 执行器实现
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

22 lines
686 B

using System.Threading.Tasks;
using DotXxlJob.Core;
using DotXxlJob.Core.Model;
namespace ASPNetCoreExecutor
{
/// <summary>
/// 示例Job,只是写个日志
/// </summary>
[JobHandler("demoJobHandler")]
public class DemoJobHandler:AbstractJobHandler
{
public override async Task<ReturnT> Execute(JobExecuteContext context)
{
context.JobLogger.Log("receive demo job handler,parameter:{0}",context.JobParameter);
context.JobLogger.Log("开始休眠10秒");
await Task.Delay(10 * 1000);
context.JobLogger.Log("休眠10秒结束");
return ReturnT.SUCCESS;
}
}
}