private async Task ProcessCompletedTaskAsync(CompletedTaskInfo taskInfo) { string taskCode = taskInfo.TaskCode; _logger.Information("正在引发任务完成事件,任务类型 {taskType},任务号 {taskCode}", taskInfo.TaskType, taskCode); if (taskInfo.TaskType == null) { string msg = string.Format("未提供任务类型。任务编号 {0}。", taskCode); throw new ApplicationException(msg); } ICompletedTaskHandler handler = GetCompletedTaskHandler(taskInfo.TaskType); if (handler == null) { throw new ApplicationException($"没有找到可用的完成处理程序。任务类型:{taskInfo.TaskType}。"); } _logger.Debug("完成处理程序是 {handlerType}。", handler.GetType()); // 判断任务是否存在 TransportTask task = await _session.Query <TransportTask>().GetTaskAsync(taskInfo.TaskCode); if (task != null) { await handler.ProcessCompletedTaskAsync(taskInfo, task); } else { _logger.Warning("未找到任务 {taskCode},已忽略", taskInfo.TaskCode); } }
public async Task ProcessCompletedTaskAsync(CompletedTaskInfo taskInfo, TransportTask task) { _logger.Debug(taskInfo.ToString()); await Task.CompletedTask; }