using System; using System.Threading.Tasks; using System.Collections.Generic; using System.Linq; using System.Text; using QM.Exchange.Interface; namespace QM.Exchange.Core.ProcessProgram { /// /// 数据处理程序执行者 /// public class CommandExecutor { private List _commands = new List(); /// /// 设置处理程序 /// /// public void SetCommand(DataCommand command) { _commands.Add(command); } /// /// 执行处理程序 /// public void Execute() { Parallel.ForEach(_commands, command => { try { IExChangeContext context = new ExChangeContext(); command.Execute(context, command.Message); } catch (Exception ex) { QMFrameWork.Log.LogManager.LogHelper.Error( new QMFrameWork.Log.LogInfo { ClientIP = "", UserName = "", Info = command.GetType().ToString(), ErrorInfo = ex }); } }); } } }