/// <summary> /// 进入非正常agent /// </summary> /// <param name="preData"></param> /// <returns></returns> internal async Task MoveUnusualAgent(IExecuteData preData) { if (UnusualAgent == null) { throw new RespException(SysRespTypes.ApplicationError, "UnusualAgent is null!"); } await UnusualAgent.MoveIn(preData); }
internal override async Task MoveSubNext(IExecuteData preData) { if (_nextAgents == null || (GatewayType == GatewayType.Branch && _nextAgents.Length == 1)) { await MoveUnusualAgent(preData); return; } await MoveMulitAgents(preData, _nextAgents); }
/// <summary> /// 单一agent前进 /// </summary> /// <param name="preData"></param> /// <param name="agent"></param> /// <returns></returns> internal async Task MoveSingleAgents(IExecuteData preData, BaseAgent agent) { if (agent == null) { await MoveUnusualAgent(preData); return; } await agent.MoveIn(preData); }
/// <summary> /// 多agent前进 /// </summary> /// <param name="preData"></param> /// <param name="agents"></param> /// <returns></returns> internal async Task MoveMulitAgents(IExecuteData preData, BaseAgent[] agents) { if (agents == null || agents.Length < 1) { await MoveUnusualAgent(preData); return; } foreach (var ag in agents) { await ag.MoveIn(preData); } }
internal async Task MoveNext(IExecuteData preData) { var aCheck = await AggregateCheck(preData); if (!aCheck) { var release = await AggregateRelease(preData); if (release) { await MoveUnusualAgent(preData); return; } } await MoveSubNext(preData); }
public ExecuteController(IExecuteData executeData) { _executeData = executeData; }
//internal override BaseAgent[] GetNextAgentMaps() //{ // return new[] {_nextAgent}; //} internal override async Task MoveSubNext(IExecuteData preData) { var agent = await(_exclusiveFunc?.Invoke(preData) ?? GetExclusiveAgent(preData)); await MoveSingleAgents(preData, agent); }
protected virtual Task <BaseAgent> GetExclusiveAgent(IExecuteData data) { return(Task.FromResult <BaseAgent>(null)); }
internal override async Task MoveSubNext(IExecuteData preData) { var agents = await(_inclusiveFunc?.Invoke(preData) ?? GetAgents(preData)); await MoveMulitAgents(preData, agents); }
protected virtual Task <BaseAgent[]> GetAgents(IExecuteData data) { return(Task.FromResult <BaseAgent[]>(null)); }
public virtual Task MoveIn(IExecuteData preData) { return(Task.CompletedTask); }
internal abstract Task MoveSubNext(IExecuteData preData);
/// <summary> /// 聚合控制释放,不再检查 /// </summary> /// <param name="preData"></param> /// <returns></returns> protected internal virtual Task <bool> AggregateRelease(IExecuteData preData) { return(Task.FromResult(true)); }