From 4332d054f2c3bda2f72701b62a61115b85b93578 Mon Sep 17 00:00:00 2001
From: qinluo <1558642210@qq.com>
Date: Thu, 27 Jul 2023 14:55:07 +0800
Subject: [PATCH 01/20] qinluo: - 1.1.3-SNAPSHOT
Signed-off-by: qinluo <1558642210@qq.com>
---
pom.xml | 4 ++--
smart-flow-admin/pom.xml | 4 ++--
smart-flow-core/pom.xml | 2 +-
smart-flow-helper/pom.xml | 2 +-
smart-flow-manager/pom.xml | 4 ++--
smart-flow-plugin/pom.xml | 2 +-
smart-flow-plugin/smart-flow-bootstrap/pom.xml | 2 +-
smart-flow-plugin/smart-flow-enhance-plugin/pom.xml | 2 +-
smart-flow-script/pom.xml | 2 +-
smart-flow-script/smart-flow-script-groovy/pom.xml | 2 +-
smart-flow-script/smart-flow-script-ognl/pom.xml | 2 +-
smart-flow-script/smart-flow-script-qlexpress/pom.xml | 2 +-
smart-flow-spring-extension/pom.xml | 2 +-
smart-flow-springboot-starter/pom.xml | 2 +-
14 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/pom.xml b/pom.xml
index 53b03fa..1fc11b8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
org.smartboot.flow
smart-flow-parent
- 1.1.2
+ 1.1.3-SNAPSHOT
4.0.0
pom
smart-flow
@@ -23,7 +23,7 @@
- 1.1.2
+ 1.1.3-SNAPSHOT
https://gitee.com/smartboot/smart-flow
diff --git a/smart-flow-admin/pom.xml b/smart-flow-admin/pom.xml
index 85828cc..f1c8545 100644
--- a/smart-flow-admin/pom.xml
+++ b/smart-flow-admin/pom.xml
@@ -5,10 +5,10 @@
smart-flow-parent
org.smartboot.flow
- 1.1.2
+ 1.1.3-SNAPSHOT
4.0.0
- 1.1.2
+ 1.1.3-SNAPSHOT
smart-flow-admin
diff --git a/smart-flow-core/pom.xml b/smart-flow-core/pom.xml
index 35b721c..a3d80cf 100644
--- a/smart-flow-core/pom.xml
+++ b/smart-flow-core/pom.xml
@@ -5,7 +5,7 @@
org.smartboot.flow
smart-flow-parent
- 1.1.2
+ 1.1.3-SNAPSHOT
4.0.0
diff --git a/smart-flow-helper/pom.xml b/smart-flow-helper/pom.xml
index 3d8489e..ef9dfb3 100644
--- a/smart-flow-helper/pom.xml
+++ b/smart-flow-helper/pom.xml
@@ -5,7 +5,7 @@
smart-flow-parent
org.smartboot.flow
- 1.1.2
+ 1.1.3-SNAPSHOT
4.0.0
diff --git a/smart-flow-manager/pom.xml b/smart-flow-manager/pom.xml
index db7aa9c..568a916 100644
--- a/smart-flow-manager/pom.xml
+++ b/smart-flow-manager/pom.xml
@@ -5,7 +5,7 @@
smart-flow-parent
org.smartboot.flow
- 1.1.2
+ 1.1.3-SNAPSHOT
4.0.0
@@ -32,7 +32,7 @@
org.smartboot.http
smart-http-client
- 1.1.22
+ 1.1.2
diff --git a/smart-flow-plugin/pom.xml b/smart-flow-plugin/pom.xml
index d6c8537..97772a1 100644
--- a/smart-flow-plugin/pom.xml
+++ b/smart-flow-plugin/pom.xml
@@ -6,7 +6,7 @@
org.smartboot.flow
smart-flow-parent
- 1.1.2
+ 1.1.3-SNAPSHOT
smart-flow-plugin
diff --git a/smart-flow-plugin/smart-flow-bootstrap/pom.xml b/smart-flow-plugin/smart-flow-bootstrap/pom.xml
index a5625c0..8a9691e 100644
--- a/smart-flow-plugin/smart-flow-bootstrap/pom.xml
+++ b/smart-flow-plugin/smart-flow-bootstrap/pom.xml
@@ -6,7 +6,7 @@
org.smartboot.flow
smart-flow-plugin
- 1.1.2
+ 1.1.3-SNAPSHOT
smart-flow-bootstrap
diff --git a/smart-flow-plugin/smart-flow-enhance-plugin/pom.xml b/smart-flow-plugin/smart-flow-enhance-plugin/pom.xml
index 77a3bc2..82e0741 100644
--- a/smart-flow-plugin/smart-flow-enhance-plugin/pom.xml
+++ b/smart-flow-plugin/smart-flow-enhance-plugin/pom.xml
@@ -6,7 +6,7 @@
org.smartboot.flow
smart-flow-plugin
- 1.1.2
+ 1.1.3-SNAPSHOT
smart-flow-enhance-plugin
diff --git a/smart-flow-script/pom.xml b/smart-flow-script/pom.xml
index c41ee12..4d9da06 100644
--- a/smart-flow-script/pom.xml
+++ b/smart-flow-script/pom.xml
@@ -5,7 +5,7 @@
smart-flow-parent
org.smartboot.flow
- 1.1.2
+ 1.1.3-SNAPSHOT
4.0.0
pom
diff --git a/smart-flow-script/smart-flow-script-groovy/pom.xml b/smart-flow-script/smart-flow-script-groovy/pom.xml
index dcb9a35..28b6190 100644
--- a/smart-flow-script/smart-flow-script-groovy/pom.xml
+++ b/smart-flow-script/smart-flow-script-groovy/pom.xml
@@ -5,7 +5,7 @@
smart-flow-script
org.smartboot.flow
- 1.1.2
+ 1.1.3-SNAPSHOT
4.0.0
diff --git a/smart-flow-script/smart-flow-script-ognl/pom.xml b/smart-flow-script/smart-flow-script-ognl/pom.xml
index 71f7076..cd755ce 100644
--- a/smart-flow-script/smart-flow-script-ognl/pom.xml
+++ b/smart-flow-script/smart-flow-script-ognl/pom.xml
@@ -5,7 +5,7 @@
smart-flow-script
org.smartboot.flow
- 1.1.2
+ 1.1.3-SNAPSHOT
4.0.0
diff --git a/smart-flow-script/smart-flow-script-qlexpress/pom.xml b/smart-flow-script/smart-flow-script-qlexpress/pom.xml
index 3c1184b..bc54432 100644
--- a/smart-flow-script/smart-flow-script-qlexpress/pom.xml
+++ b/smart-flow-script/smart-flow-script-qlexpress/pom.xml
@@ -5,7 +5,7 @@
smart-flow-script
org.smartboot.flow
- 1.1.2
+ 1.1.3-SNAPSHOT
4.0.0
diff --git a/smart-flow-spring-extension/pom.xml b/smart-flow-spring-extension/pom.xml
index 14ad1b0..2c3a55b 100644
--- a/smart-flow-spring-extension/pom.xml
+++ b/smart-flow-spring-extension/pom.xml
@@ -5,7 +5,7 @@
smart-flow-parent
org.smartboot.flow
- 1.1.2
+ 1.1.3-SNAPSHOT
4.0.0
diff --git a/smart-flow-springboot-starter/pom.xml b/smart-flow-springboot-starter/pom.xml
index e90b4f5..867d88b 100644
--- a/smart-flow-springboot-starter/pom.xml
+++ b/smart-flow-springboot-starter/pom.xml
@@ -5,7 +5,7 @@
smart-flow-parent
org.smartboot.flow
- 1.1.2
+ 1.1.3-SNAPSHOT
4.0.0
--
Gitee
From 498b0f274eb57b51c41886db3a8e200ad43b1a3f Mon Sep 17 00:00:00 2001
From: qinluo <1558642210@qq.com>
Date: Thu, 27 Jul 2023 15:07:06 +0800
Subject: [PATCH 02/20] =?UTF-8?q?qinluo:=20=20=20=20=20=20-=20=E6=9B=B4?=
=?UTF-8?q?=E5=BF=AB=E6=8D=B7=E7=9A=84=E6=B5=81=E7=A8=8B=E4=B8=AD=E6=96=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: qinluo <1558642210@qq.com>
---
.../flow/core/EngineContextHelper.java | 39 +++++++++++++++++++
.../org/smartboot/flow/core/FlowEngine.java | 2 +
.../core/executable/AbstractExecutable.java | 19 +++++++++
.../flow/core/invoker/AsyncRunner.java | 7 ++++
4 files changed, 67 insertions(+)
create mode 100644 smart-flow-core/src/main/java/org/smartboot/flow/core/EngineContextHelper.java
diff --git a/smart-flow-core/src/main/java/org/smartboot/flow/core/EngineContextHelper.java b/smart-flow-core/src/main/java/org/smartboot/flow/core/EngineContextHelper.java
new file mode 100644
index 0000000..86341b2
--- /dev/null
+++ b/smart-flow-core/src/main/java/org/smartboot/flow/core/EngineContextHelper.java
@@ -0,0 +1,39 @@
+package org.smartboot.flow.core;
+
+/**
+ * @author qinluo
+ * @date 2023-07-27 14:55:42
+ * @since 1.1.3
+ */
+@SuppressWarnings("rawtypes")
+public class EngineContextHelper {
+
+ private static final ThreadLocal HOLDER = new ThreadLocal<>();
+
+ public static void set(EngineContext ctx) {
+ HOLDER.set(ctx);
+ }
+
+ public static EngineContext get() {
+ return HOLDER.get();
+ }
+
+ public static void remove() {
+ HOLDER.remove();
+ }
+
+ public static void broken(boolean broken) {
+ EngineContext ctx = get();
+ if (ctx != null) {
+ ctx.broken(broken);
+ }
+ }
+
+ public static void brokenAll(boolean broken) {
+ EngineContext ctx = get();
+ if (ctx != null) {
+ ctx.brokenAll(broken);
+ }
+ }
+
+}
diff --git a/smart-flow-core/src/main/java/org/smartboot/flow/core/FlowEngine.java b/smart-flow-core/src/main/java/org/smartboot/flow/core/FlowEngine.java
index 5ee4d81..530660e 100644
--- a/smart-flow-core/src/main/java/org/smartboot/flow/core/FlowEngine.java
+++ b/smart-flow-core/src/main/java/org/smartboot/flow/core/FlowEngine.java
@@ -85,6 +85,7 @@ public class FlowEngine implements Describable, Validator, Measurable {
}
private void start(EngineContext context) {
+ EngineContextHelper.set(context);
context.executedAt = System.currentTimeMillis();
context.listener.start(context);
}
@@ -92,6 +93,7 @@ public class FlowEngine implements Describable, Validator, Measurable {
private void complete(EngineContext context) {
context.completedAt = System.currentTimeMillis();
context.listener.completed(context);
+ EngineContextHelper.remove();
}
protected void initContext(EngineContext context) {
diff --git a/smart-flow-core/src/main/java/org/smartboot/flow/core/executable/AbstractExecutable.java b/smart-flow-core/src/main/java/org/smartboot/flow/core/executable/AbstractExecutable.java
index 12c6915..b4c7e31 100644
--- a/smart-flow-core/src/main/java/org/smartboot/flow/core/executable/AbstractExecutable.java
+++ b/smart-flow-core/src/main/java/org/smartboot/flow/core/executable/AbstractExecutable.java
@@ -2,6 +2,7 @@ package org.smartboot.flow.core.executable;
import org.smartboot.flow.core.EngineContext;
+import org.smartboot.flow.core.EngineContextHelper;
/**
* 调用层,与业务相关
@@ -29,4 +30,22 @@ public abstract class AbstractExecutable implements Executable {
public void rollback(T t, S s) {
}
+
+ /**
+ * Broken current subprocess.
+ *
+ * @since 1.1.3
+ */
+ protected void broken() {
+ EngineContextHelper.broken(true);
+ }
+
+ /**
+ * Broken whole process.
+ *
+ * @since 1.1.3
+ */
+ protected void brokenAll() {
+ EngineContextHelper.brokenAll(true);
+ }
}
diff --git a/smart-flow-core/src/main/java/org/smartboot/flow/core/invoker/AsyncRunner.java b/smart-flow-core/src/main/java/org/smartboot/flow/core/invoker/AsyncRunner.java
index 842ce47..c02a484 100644
--- a/smart-flow-core/src/main/java/org/smartboot/flow/core/invoker/AsyncRunner.java
+++ b/smart-flow-core/src/main/java/org/smartboot/flow/core/invoker/AsyncRunner.java
@@ -1,5 +1,7 @@
package org.smartboot.flow.core.invoker;
+import org.smartboot.flow.core.EngineContext;
+import org.smartboot.flow.core.EngineContextHelper;
import org.smartboot.flow.core.trace.Node;
import org.smartboot.flow.core.trace.Tracer;
@@ -10,15 +12,18 @@ import java.util.concurrent.Callable;
* @date 2022-12-07 21:57:39
* @since 1.0.0
*/
+@SuppressWarnings("rawtypes")
public class AsyncRunner implements Callable {
private final Callable task;
private final Node root;
private final long threadId;
+ private final EngineContext ctx;
public AsyncRunner(Callable task) {
this.task = task;
this.root = Tracer.get();
+ this.ctx = EngineContextHelper.get();
this.threadId = Thread.currentThread().getId();
}
@@ -38,6 +43,7 @@ public class AsyncRunner implements Callable {
if (tid != threadId) {
Tracer.setNode(root);
}
+ EngineContextHelper.set(ctx);
}
protected void doAfterRun() {
@@ -45,5 +51,6 @@ public class AsyncRunner implements Callable {
if (tid != threadId) {
Tracer.remove();
}
+ EngineContextHelper.remove();
}
}
--
Gitee
From fe166367984dce09ed12a1c96417f92635af454c Mon Sep 17 00:00:00 2001
From: qinluo <1558642210@qq.com>
Date: Fri, 28 Jul 2023 17:46:21 +0800
Subject: [PATCH 03/20] qinluo: - ignore
Signed-off-by: qinluo <1558642210@qq.com>
---
smart-flow-manager/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/smart-flow-manager/pom.xml b/smart-flow-manager/pom.xml
index 568a916..5a4b28e 100644
--- a/smart-flow-manager/pom.xml
+++ b/smart-flow-manager/pom.xml
@@ -32,7 +32,7 @@
org.smartboot.http
smart-http-client
- 1.1.2
+ 1.1.22
--
Gitee
From 18de20d0924708690c520c3383daa0d91d39b777 Mon Sep 17 00:00:00 2001
From: qinluo <1558642210@qq.com>
Date: Wed, 2 Aug 2023 09:05:14 +0800
Subject: [PATCH 04/20] qinluo: - remove deprecated methods.
Signed-off-by: qinluo <1558642210@qq.com>
---
.../flow/core/manager/DefaultEngineManager.java | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/smart-flow-core/src/main/java/org/smartboot/flow/core/manager/DefaultEngineManager.java b/smart-flow-core/src/main/java/org/smartboot/flow/core/manager/DefaultEngineManager.java
index d13f34a..49e7fa6 100644
--- a/smart-flow-core/src/main/java/org/smartboot/flow/core/manager/DefaultEngineManager.java
+++ b/smart-flow-core/src/main/java/org/smartboot/flow/core/manager/DefaultEngineManager.java
@@ -23,17 +23,6 @@ public class DefaultEngineManager implements EngineManager {
private final Map registeredEngines = new ConcurrentHashMap<>();
- /**
- * Return singleton instance.
- * Will remove at 1.1.0, please use {@link EngineManager#defaultManager()}.
- *
- * @return singleton instance.
- */
- @Deprecated
- public static EngineManager getDefaultManager() {
- return INSTANCE;
- }
-
/**
* Rename getDefaultManager to getInstance.
*
--
Gitee
From 9cd1fcd544610d5ad826cab8499107116fc96387 Mon Sep 17 00:00:00 2001
From: qinluo <1558642210@qq.com>
Date: Wed, 2 Aug 2023 10:02:43 +0800
Subject: [PATCH 05/20] =?UTF-8?q?qinluo:=20=20=20=20=20=20-=20trace?=
=?UTF-8?q?=E9=87=87=E9=9B=86=E9=87=8D=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: qinluo <1558642210@qq.com>
---
smart-flow-manager/pom.xml | 1 +
.../flow/manager/trace/HttpTraceReporter.java | 107 ++++++++
.../flow/manager/trace/LogTraceReporter.java | 27 ++
.../trace/ManagerExecutionListener.java | 8 +-
.../flow/manager/trace/TraceCollector.java | 133 +++++++++
.../flow/manager/trace/TraceReporter.java | 255 +-----------------
.../manager/trace/TraceRequestConverter.java | 87 ++++++
7 files changed, 366 insertions(+), 252 deletions(-)
create mode 100644 smart-flow-manager/src/main/java/org/smartboot/flow/manager/trace/HttpTraceReporter.java
create mode 100644 smart-flow-manager/src/main/java/org/smartboot/flow/manager/trace/LogTraceReporter.java
create mode 100644 smart-flow-manager/src/main/java/org/smartboot/flow/manager/trace/TraceCollector.java
create mode 100644 smart-flow-manager/src/main/java/org/smartboot/flow/manager/trace/TraceRequestConverter.java
diff --git a/smart-flow-manager/pom.xml b/smart-flow-manager/pom.xml
index 5a4b28e..fd293d7 100644
--- a/smart-flow-manager/pom.xml
+++ b/smart-flow-manager/pom.xml
@@ -14,6 +14,7 @@
8
8
+ UTF-8
diff --git a/smart-flow-manager/src/main/java/org/smartboot/flow/manager/trace/HttpTraceReporter.java b/smart-flow-manager/src/main/java/org/smartboot/flow/manager/trace/HttpTraceReporter.java
new file mode 100644
index 0000000..7dad8b2
--- /dev/null
+++ b/smart-flow-manager/src/main/java/org/smartboot/flow/manager/trace/HttpTraceReporter.java
@@ -0,0 +1,107 @@
+package org.smartboot.flow.manager.trace;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.smartboot.flow.core.FlowEngine;
+import org.smartboot.flow.core.manager.EngineManager;
+import org.smartboot.flow.manager.ManagerConstants;
+import org.smartboot.flow.manager.UpdateContentTask;
+import org.smartboot.http.client.HttpClient;
+import org.smartboot.http.client.HttpPost;
+import org.smartboot.http.common.enums.HeaderNameEnum;
+
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.util.Map;
+
+/**
+ * @author qinluo
+ * @date 2023-02-07
+ * @since 1.1.3
+ */
+public class HttpTraceReporter implements TraceReporter {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(HttpTraceReporter.class);
+
+ /**
+ * 服务端地址
+ */
+ private String serverAddress;
+
+ /**
+ * 超时时间
+ */
+ private long timeout;
+ private String host;
+ private int port;
+
+ private Map headers;
+
+ @Override
+ public void report(TraceData trace) {
+ EngineManager defaultManager = EngineManager.defaultManager();
+
+ HttpClient httpClient = new HttpClient(host, port);
+ httpClient.configuration().connectTimeout((int) timeout);
+ HttpPost post = httpClient.post(ManagerConstants.REPORT_TRACE);
+
+ if (headers != null) {
+ headers.forEach((key, value) -> post.header().add(key, value));
+ }
+
+ FlowEngine