示例#1
0
        public void Execute(IDictionary <string, object> context)
        {
            if (RunCondition != null)
            {
                if (!RunCondition.Provide(context))
                {
                    if (log.IsEnabledFor(LogEvent.Debug))
                    {
                        log.Write(LogEvent.Debug, new{ Condition = false, Context = context });
                    }
                    return;
                }
                else
                {
                    if (log.IsEnabledFor(LogEvent.Debug))
                    {
                        log.Write(LogEvent.Debug, new{ Condition = true, Context = context });
                    }
                }
            }

            object res = Provide(context);

            if (ResultKey != null)
            {
                if (log.IsEnabledFor(LogEvent.Debug))
                {
                    log.Write(LogEvent.Debug, new{ Result = res, ResultKey = ResultKey });
                }
                context[ResultKey] = res;
            }
        }
示例#2
0
        internal override TRes RunCheckInternal(ExecuteData <TReq> req, RunCondition runCondition)
        {
            if (req.req_data == null)
            {
                return(new TRes().WithResult(SysResultTypes.ApplicationError, "Task must Run with request info!"));
            }

            return(base.RunCheckInternal(req, runCondition));
        }
示例#3
0
 public bool CheckRunCondition()
 {
     return(RunCondition.GetInvocationList().Cast <Func <bool> >().All(f => f()));
 }
示例#4
0
 /// <summary>
 ///  保存对应运行请求和重试相关信息
 /// </summary>
 /// <returns></returns>
 protected virtual Task SaveErrorNodeContext(TTData data, TTRes resp,
                                             RunCondition cond, IDictionary <TaskMeta, TaskResp <Resp> > taskResults)
 {
     return(Task.CompletedTask);
 }
示例#5
0
 /// <summary>
 ///  保存对应运行请求和重试相关信息
 ///    【仅在 OwnerType = OwnerType.Task 时发生】
 ///     节点下的环境信息,由节点内部处理,防止节点其他耗时任务造成执行过程中发起重试操作
 /// </summary>
 /// <param name="data"></param>
 /// <param name="resp"></param>
 /// <param name="cond"></param>
 /// <returns></returns>
 protected virtual Task SaveErrorTaskContext(TTData data, TTRes resp, RunCondition cond)
 {
     return(Task.CompletedTask);
 }