mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-19 16:06:33 +08:00
1. 修改了FlowResult的创建方式,新增了IsSuccess与Message,为后续进行流程日志追踪准备。
2. 修复了删除节点时,没有正确消除与之相关的参数获取关系。 3. IFlowNode新增了StartFlowAsync方法。 4. Library项目中FlowNodeExtension拓展类转移到了NodeFlow项目中。 5. 修改了Script自定义参数保存,对参数类型、返回值类型进行保存。 6. Library.Utils.BenchmarkHelpter中添加了Task、Task<>的重载方法。 7. NodeFlow项目中,FlowEnvironment默认使用通过NewtonsoftJson实现的JSON门户类。 8. NodeFlow项目中,FlowControl缓存了 FlowWorkOptions 选项实体,并且对于 FlowWorkManagement 进行了池化管理(但后续的项目中考虑重构流程任务运行时)。
This commit is contained in:
@@ -224,7 +224,7 @@ namespace Serein.Library
|
||||
/// <param name="data"></param>
|
||||
public void AddOrUpdate(string nodeModel, object data)
|
||||
{
|
||||
var flowData = new FlowResult(nodeModel, this, data);
|
||||
var flowData = FlowResult.OK(nodeModel, this, data);
|
||||
dictNodeFlowData.AddOrUpdate(nodeModel, _ => flowData, (o, n) => flowData);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,23 +31,35 @@ namespace Serein.Library
|
||||
/// </summary>
|
||||
/// <param name="nodeGuid"></param>
|
||||
/// <param name="context"></param>
|
||||
public FlowResult(string nodeGuid, IFlowContext context, object value)
|
||||
public static FlowResult OK(string nodeGuid, IFlowContext context, object value)
|
||||
{
|
||||
this.SourceNodeGuid = nodeGuid;
|
||||
this.ContextGuid = context.Guid;
|
||||
this.Value = value;
|
||||
FlowResult flowResult = new FlowResult
|
||||
{
|
||||
SourceNodeGuid = nodeGuid,
|
||||
ContextGuid = context.Guid,
|
||||
Value = value,
|
||||
IsSuccess = true,
|
||||
};
|
||||
return flowResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 空返回值
|
||||
/// 失败
|
||||
/// </summary>
|
||||
/// <param name="nodeGuid"></param>
|
||||
/// <param name="context"></param>
|
||||
public FlowResult(string nodeGuid, IFlowContext context)
|
||||
/// <param name="message"></param>
|
||||
public static FlowResult Fail(string nodeGuid, IFlowContext context, string message)
|
||||
{
|
||||
this.SourceNodeGuid = nodeGuid;
|
||||
this.ContextGuid = context.Guid;
|
||||
this.Value = Unit.Default;
|
||||
FlowResult flowResult = new FlowResult
|
||||
{
|
||||
SourceNodeGuid = nodeGuid,
|
||||
ContextGuid = context.Guid,
|
||||
Value = Unit.Default,
|
||||
IsSuccess = true,
|
||||
Message = message,
|
||||
};
|
||||
return flowResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -72,16 +84,26 @@ namespace Serein.Library
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 指示是否成功
|
||||
/// </summary>
|
||||
public bool IsSuccess { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 执行结果消息(提示异常)
|
||||
/// </summary>
|
||||
public string Message { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 来源节点Guid
|
||||
/// </summary>
|
||||
public string SourceNodeGuid{ get; }
|
||||
public string SourceNodeGuid{ get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 来源上下文Guid
|
||||
/// </summary>
|
||||
public string ContextGuid { get; }
|
||||
public string ContextGuid { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据值
|
||||
/// </summary>
|
||||
|
||||
@@ -300,7 +300,7 @@ namespace Serein.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
flowResult = new FlowResult(currentNode.Guid, context);
|
||||
flowResult = FlowResult.Fail(currentNode.Guid, context, ex.Message);
|
||||
context.Env.WriteLine(InfoType.ERROR, $"节点[{currentNode}]异常:" + ex);
|
||||
context.NextOrientation = ConnectionInvokeType.IsError;
|
||||
context.ExceptionOfRuning = ex;
|
||||
|
||||
Reference in New Issue
Block a user