Beispiel #1
0
        public async Task Execute(IJobExecutionContext context)
        {
            var jobId = context.JobDetail.JobDataMap["id"];

            Logger.JobId = jobId == null ? Guid.Empty : Guid.Parse(jobId.ToString());

            await Logger.Info("任务开始");

            try
            {
                await Execute(new JobTaskContext
                {
                    JobId = Logger.JobId,
                    JobExecutionContext = context
                });
            }
            catch (Exception ex)
            {
                await Logger.Error("任务异常:" + ex);
            }

            await Logger.Info("任务结束");
        }