diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/builder/el/operator/base/BaseOperator.java b/liteflow-core/src/main/java/com/yomahub/liteflow/builder/el/operator/base/BaseOperator.java index f61db65dc..3a418e35b 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/builder/el/operator/base/BaseOperator.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/builder/el/operator/base/BaseOperator.java @@ -23,7 +23,7 @@ public abstract class BaseOperator implements QLFunctional throw e; } catch (Exception e) { - throw new ELParseException("errors occurred in EL parsing"); + throw new ELParseException("errors occurred in EL parsing with operator[" + this.getClass().getSimpleName() + "]: " + e.getMessage(), e); } } diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/core/NodeComponent.java b/liteflow-core/src/main/java/com/yomahub/liteflow/core/NodeComponent.java index bfff8ebe4..b4dbe973a 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/core/NodeComponent.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/core/NodeComponent.java @@ -102,6 +102,8 @@ public abstract class NodeComponent{ cmpStep.setRefNode(this.getRefNode()); cmpStep.setStartTime(new Date()); cmpStep.setThreadName(Thread.currentThread().getName()); + cmpStep.setChainId(this.getRefNode().getCurrChainId()); + cmpStep.setLoopIndex(this.getRefNode().getLoopIndex()); slot.addStep(cmpStep); StopWatch stopWatch = new StopWatch(); diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/core/proxy/LiteFlowProxyUtil.java b/liteflow-core/src/main/java/com/yomahub/liteflow/core/proxy/LiteFlowProxyUtil.java index 53f54ab48..6d5631a52 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/core/proxy/LiteFlowProxyUtil.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/core/proxy/LiteFlowProxyUtil.java @@ -44,7 +44,7 @@ public class LiteFlowProxyUtil { }catch (Exception e) { String errMsg = StrUtil.format("Error while proxying bean[{}]", declWarpBean.getRawClazz().getName()); LOG.error(errMsg); - throw new ComponentProxyErrorException(errMsg); + throw new ComponentProxyErrorException(errMsg, e); } } diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ComponentCannotRegisterException.java b/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ComponentCannotRegisterException.java index 16259cca4..3ed1a0e1e 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ComponentCannotRegisterException.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ComponentCannotRegisterException.java @@ -18,6 +18,11 @@ public class ComponentCannotRegisterException extends RuntimeException { this.message = message; } + public ComponentCannotRegisterException(String message, Throwable cause) { + super(message, cause); + this.message = message; + } + @Override public String getMessage() { return message; diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ComponentProxyErrorException.java b/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ComponentProxyErrorException.java index 5ab8fb8e0..f902a61ea 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ComponentProxyErrorException.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ComponentProxyErrorException.java @@ -17,6 +17,11 @@ public class ComponentProxyErrorException extends RuntimeException { this.message = message; } + public ComponentProxyErrorException(String message, Throwable cause) { + super(message, cause); + this.message = message; + } + @Override public String getMessage() { return message; diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ELParseException.java b/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ELParseException.java index fa56e01d2..4c8770c6b 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ELParseException.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ELParseException.java @@ -18,6 +18,11 @@ public class ELParseException extends RuntimeException { this.message = message; } + public ELParseException(String message, Throwable cause) { + super(message, cause); + this.message = message; + } + @Override public String getMessage() { return message; diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ParallelExecutorCreateException.java b/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ParallelExecutorCreateException.java index 68ea8a39a..4fcbad4ac 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ParallelExecutorCreateException.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ParallelExecutorCreateException.java @@ -17,6 +17,11 @@ public class ParallelExecutorCreateException extends RuntimeException { this.message = message; } + public ParallelExecutorCreateException(String message, Throwable cause) { + super(message, cause); + this.message = message; + } + @Override public String getMessage() { return message; diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/exception/RequestIdGeneratorException.java b/liteflow-core/src/main/java/com/yomahub/liteflow/exception/RequestIdGeneratorException.java index 632053ccf..9adcc87e3 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/exception/RequestIdGeneratorException.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/exception/RequestIdGeneratorException.java @@ -18,6 +18,11 @@ public class RequestIdGeneratorException extends RuntimeException { this.message = message; } + public RequestIdGeneratorException(String message, Throwable cause) { + super(message, cause); + this.message = message; + } + @Override public String getMessage() { return message; diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ThreadExecutorServiceCreateException.java b/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ThreadExecutorServiceCreateException.java index f2c9a29dd..0c970ff98 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ThreadExecutorServiceCreateException.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/exception/ThreadExecutorServiceCreateException.java @@ -17,6 +17,11 @@ public class ThreadExecutorServiceCreateException extends RuntimeException { this.message = message; } + public ThreadExecutorServiceCreateException(String message, Throwable cause) { + super(message, cause); + this.message = message; + } + @Override public String getMessage() { return message; diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java index 9aefab85c..c9501efd4 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java @@ -188,7 +188,7 @@ public class FlowBus { cmpClazz = Class.forName(cmpClazzStr); } catch (Exception e) { - throw new ComponentCannotRegisterException(e.getMessage()); + throw new ComponentCannotRegisterException(e.getMessage(), e); } addNode(nodeId, name, nodeType, cmpClazz, null, null); } @@ -282,7 +282,7 @@ public class FlowBus { } catch (Exception e) { String error = StrUtil.format("component[{}] register error", StrUtil.isEmpty(name) ? nodeId : StrUtil.format("{}({})", nodeId, name)); LOG.error(e.getMessage()); - throw new ComponentCannotRegisterException(StrUtil.format("{} {}", error, e.getMessage())); + throw new ComponentCannotRegisterException(StrUtil.format("{} {}", error, e.getMessage()), e); } } @@ -342,11 +342,11 @@ public class FlowBus { + error; LOG.error(error, e); - throw new ComponentCannotRegisterException(StrUtil.format("{} {}", error, e.getMessage())); + throw new ComponentCannotRegisterException(StrUtil.format("{} {}", error, e.getMessage()), e); } catch (Exception e) { String error = StrUtil.format("component[{}] register error", StrUtil.isEmpty(name) ? nodeId : StrUtil.format("{}({})", nodeId, name)); LOG.error(e.getMessage()); - throw new ComponentCannotRegisterException(StrUtil.format("{} {}", error, e.getMessage())); + throw new ComponentCannotRegisterException(StrUtil.format("{} {}", error, e.getMessage()), e); } } diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/entity/CmpStep.java b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/entity/CmpStep.java index 166552073..6bb26c62e 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/entity/CmpStep.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/entity/CmpStep.java @@ -62,6 +62,12 @@ public class CmpStep { // 运行线程名称 private String threadName; + // 所属 chainId(诊断用:节点被多条链复用时回溯调用路径) + private String chainId; + + // 循环迭代下标(诊断用:循环内失败时定位是第几次迭代,非循环场景为 null) + private Integer loopIndex; + public CmpStep(String nodeId, String nodeName, CmpStepTypeEnum stepType) { this.nodeId = nodeId; @@ -69,6 +75,22 @@ public class CmpStep { this.stepType = stepType; } + public String getChainId() { + return chainId; + } + + public void setChainId(String chainId) { + this.chainId = chainId; + } + + public Integer getLoopIndex() { + return loopIndex; + } + + public void setLoopIndex(Integer loopIndex) { + this.loopIndex = loopIndex; + } + public String getNodeInstanceId() { return nodeInstanceId; } diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/id/IdGeneratorHolder.java b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/id/IdGeneratorHolder.java index 2253f0891..0ebec4697 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/id/IdGeneratorHolder.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/id/IdGeneratorHolder.java @@ -35,7 +35,7 @@ public class IdGeneratorHolder { INSTANCE.setRequestIdGenerator(requestIdGenerator); } catch (Exception e) { - throw new RequestIdGeneratorException(e.getMessage()); + throw new RequestIdGeneratorException(e.getMessage(), e); } } diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/parallel/strategy/ParallelStrategyHelper.java b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/parallel/strategy/ParallelStrategyHelper.java index c790230a1..a2619cfed 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/parallel/strategy/ParallelStrategyHelper.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/parallel/strategy/ParallelStrategyHelper.java @@ -53,7 +53,7 @@ public class ParallelStrategyHelper { return strategyExecutor; } catch (Exception e) { LOG.error(e.getMessage()); - throw new ParallelExecutorCreateException(e.getMessage()); + throw new ParallelExecutorCreateException(e.getMessage(), e); } } diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/thread/ExecutorHelper.java b/liteflow-core/src/main/java/com/yomahub/liteflow/thread/ExecutorHelper.java index 3a2a38b0e..0db64b2e4 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/thread/ExecutorHelper.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/thread/ExecutorHelper.java @@ -166,7 +166,7 @@ public class ExecutorHelper { } catch (Exception e) { LOG.error(e.getMessage()); - throw new ThreadExecutorServiceCreateException(e.getMessage()); + throw new ThreadExecutorServiceCreateException(e.getMessage(), e); } }