业务可视化-让你的流程图"Run"起来(4.实际业务场景测试)

前言

首先,感谢大家对上一篇文章[业务可视化-让你的流程图"Run"起来(3.分支选择&跨语言分布式运行节点)]的支持。

下面我以实际业务场景为例,来介绍一下ladybugflow的使用方法。

酒店预定场景(传统写法)

对于下面的酒店预定流程

流程1:

业务可视化-让你的流程图"Run"起来(4.实际业务场景测试)

流程2

业务可视化-让你的流程图"Run"起来(4.实际业务场景测试)

 

[流程1]的传统写法1:

定义流程间共享变量; 开始处理();  查询客户信息处理(); 查询酒店信息处理();  下单处理(); 下单成功处理();

假设每个流程用3秒钟,整个流程执行完需要3*5=15秒。

于是衍生出了写法2:

定义流程间共享变量; 开始处理();  启动 查询客户信息线程处理 A; 启动 查询酒店信息线程处理 B; 等待A,B结束;  下单处理(); 下单成功处理();

节省了时间,但各种多线程的实现方式使程序变得复杂,

而且上述写法都把流程图与业务逻辑进行了绑定

也就是流程图中添加,删除节点后,相应的逻辑代码也要修改,测试范围往往是整个流程图的业务逻辑都要进行测试。

酒店预定场景(新写法)

针对上面的问题,我在设计ladybugflow的时候,把流程图和业务逻辑进行了分离

每个业务逻辑对应一个方法,与流程图中的节点进行绑定。

这样修改流程图就不用修改业务逻辑了。

而且流程图可以通过工具拖拽方式生成,还可以在图上查看运行结果。

下面介绍一下ladybugflow中的开发过程

1. 导入依赖

Maven
<!-- https://mvnrepository.com/artifact/io.github.nobuglady/ladybugflow --> <dependency>     <groupId>io.github.nobuglady</groupId>     <artifactId>ladybugflow</artifactId>     <version>0.0.6</version> </dependency>
Gradle
// https://mvnrepository.com/artifact/io.github.nobuglady/ladybugflow implementation 'io.github.nobuglady:ladybugflow:0.0.6'

2. 画流程图,并且生成Json文件

首先把这个文件下载到本地,用浏览器打开

https://github.com/nobuglady/ladybugflow/blob/main/html/network.html

业务可视化-让你的流程图&quot;Run&quot;起来(4.实际业务场景测试)

然后点击页面上的[edit]按钮可以画流程图,

画完流程图后,点击[update json]按钮,可以生成流程图对应的json文件。

3. 写业务方法

流程图的每个节点对应下面的一个方法,用@Node注解来关联流程图。

可以用类变量进行参数传递和表示结果,比如下单成功后,设置类变量为"success"。

注:建议用节点ID进行关联,本文为了看起来方便,选择了中文的节点名称进行关联

Flow1.java(注意文件编码为UTF-8)

 /**  *   * @author NoBugLady  *  */ public class Flow1 extends FlowRunner {  	private String result; 	 	public String getResult() { 		return result; 	} 	 	@Node(label = "start") 	public void processStart() throws InterruptedException { 		System.out.println("启动开始 (模拟业务等待3秒)"); 		Thread.sleep(3000); 		System.out.println("启动结束"); 	}  	@Node(label = "查询用户信息") 	public void processSearchUser() throws InterruptedException { 		System.out.println("查询用户信息开始 (模拟业务等待3秒)"); 		Thread.sleep(3000); 		System.out.println("查询用户信息结束"); 	}  	@Node(label = "查询酒店信息") 	public void processSearchHotel() throws InterruptedException { 		System.out.println("查询酒店信息开始 (模拟业务等待3秒)"); 		Thread.sleep(3000); 		System.out.println("查询酒店信息结束"); 	}  	@Node(label = "下单") 	public void processOrder() throws InterruptedException { 		System.out.println("下单开始 (模拟业务等待3秒)"); 		Thread.sleep(3000); 		System.out.println("下单结束"); 	}  	@Node(label = "下单成功") 	public void processSuccess() throws InterruptedException { 		System.out.println("下单成功开始 (模拟业务等待3秒)"); 		Thread.sleep(3000); 		System.out.println("下单成功结束"); 		result = "success"; 	} }

4. 将流程图的Json文件放入工程

Flow1.json(注意文件编码为UTF-8)

{ 	"flowId": "your flow id", 	"nodes": [ 		{ 			"id": "1", 			"label": "start" 		}, 		{ 			"id": "a1a38c2e-0e05-4c68-bd49-f12aea070876", 			"label": "查询用户信息", 			"readyCheck": 0 		}, 		{ 			"id": "1a90a997-4390-470a-ae7c-626a725438d2", 			"label": "查询酒店信息", 			"readyCheck": 0 		}, 		{ 			"id": "52289e99-363d-4453-8077-ca8bdc6d35bf", 			"label": "下单", 			"readyCheck": 0 		}, 		{ 			"id": "16422cbb-ccb0-4fe2-952b-e3ad5c3acbb2", 			"label": "下单成功", 			"readyCheck": 0 		} 	], 	"edges": [ 		{ 			"id": "1", 			"from": "1", 			"to": "2", 			"arrows": "to" 		}, 		{ 			"id": "b3ad7ab3-8fb6-4527-8cae-6845e03da3e4", 			"from": "1", 			"to": "a1a38c2e-0e05-4c68-bd49-f12aea070876", 			"arrows": "to" 		}, 		{ 			"id": "001375c7-19e7-436b-bbcd-68e36c8f23b7", 			"from": "1", 			"to": "1a90a997-4390-470a-ae7c-626a725438d2", 			"arrows": "to" 		}, 		{ 			"id": "dd830043-c7a7-4c71-b91c-10c007b7b19c", 			"from": "1a90a997-4390-470a-ae7c-626a725438d2", 			"to": "52289e99-363d-4453-8077-ca8bdc6d35bf", 			"arrows": "to" 		}, 		{ 			"id": "21c2c69d-0050-4eca-8283-5a2bcbdc6c37", 			"from": "52289e99-363d-4453-8077-ca8bdc6d35bf", 			"to": "16422cbb-ccb0-4fe2-952b-e3ad5c3acbb2", 			"arrows": "to" 		}, 		{ 			"id": "19f2f329-8163-4dc6-a353-800df79d18a6", 			"from": "a1a38c2e-0e05-4c68-bd49-f12aea070876", 			"to": "52289e99-363d-4453-8077-ca8bdc6d35bf", 			"arrows": "to" 		} 	] }

项目结构如下图所示

Flow1.java和Flow1.json需要放到同一个包下。

业务可视化-让你的流程图&quot;Run&quot;起来(4.实际业务场景测试)

5. 启动流程

App1.java(注意文件编码为UTF-8)

/**  *   * @author NoBugLady  *  */ public class App1 {  	public static void main(String[] args) { 		 		Flow1 testFlow = new Flow1(); 		testFlow.startFlow(true); 		 		System.out.println(testFlow.getResult()); 		 		// 不建议每次都调用shutdown,可以在整个App关闭的时候调用一次shutdown 		FlowStarter.shutdown(); 		 	} }

6. 查看运行结果

[I]2022/07/27 21:23:12.172  main:ladybugflow.properties in root path not found, use default configuration [I]2022/07/27 21:23:12.177  main:NodePool started. [I]2022/07/27 21:23:12.178  main:Ready queue consumer thread started. [I]2022/07/27 21:23:12.180  main:Complete queue consumer thread started. [I]2022/07/27 21:23:12.993 [your flow id][38f3567d-77fb-4629-bf7e-68b27633ed68] main:json: {"flowId":"your flow id","nodes":[{"id":"1","label":"start","readyCheck":0},{"id":"a1a38c2e-0e05-4c68-bd49-f12aea070876","label":"查询用户信息","readyCheck":0},{"id":"1a90a997-4390-470a-ae7c-626a725438d2","label":"查询酒店信息","readyCheck":0},{"id":"52289e99-363d-4453-8077-ca8bdc6d35bf","label":"下单","readyCheck":0},{"id":"16422cbb-ccb0-4fe2-952b-e3ad5c3acbb2","label":"下单成功","readyCheck":0}],"edges":[{"id":"1","from":"1","to":"2","condition":null,"arrows":"to"},{"id":"b3ad7ab3-8fb6-4527-8cae-6845e03da3e4","from":"1","to":"a1a38c2e-0e05-4c68-bd49-f12aea070876","condition":null,"arrows":"to"},{"id":"001375c7-19e7-436b-bbcd-68e36c8f23b7","from":"1","to":"1a90a997-4390-470a-ae7c-626a725438d2","condition":null,"arrows":"to"},{"id":"dd830043-c7a7-4c71-b91c-10c007b7b19c","from":"1a90a997-4390-470a-ae7c-626a725438d2","to":"52289e99-363d-4453-8077-ca8bdc6d35bf","condition":null,"arrows":"to"},{"id":"21c2c69d-0050-4eca-8283-5a2bcbdc6c37","from":"52289e99-363d-4453-8077-ca8bdc6d35bf","to":"16422cbb-ccb0-4fe2-952b-e3ad5c3acbb2","condition":null,"arrows":"to"},{"id":"19f2f329-8163-4dc6-a353-800df79d18a6","from":"a1a38c2e-0e05-4c68-bd49-f12aea070876","to":"52289e99-363d-4453-8077-ca8bdc6d35bf","condition":null,"arrows":"to"}]} [I]2022/07/27 21:23:12.996 [your flow id][38f3567d-77fb-4629-bf7e-68b27633ed68] pool-1-thread-1:execute node id:1 [I]2022/07/27 21:23:12.996 [your flow id][38f3567d-77fb-4629-bf7e-68b27633ed68] pool-1-thread-1:execute node name:start 启动开始 (模拟业务等待3秒) 启动结束 [I]2022/07/27 21:23:16.003 [your flow id][38f3567d-77fb-4629-bf7e-68b27633ed68] pool-1-thread-1:execute node id:a1a38c2e-0e05-4c68-bd49-f12aea070876 [I]2022/07/27 21:23:16.003 [your flow id][38f3567d-77fb-4629-bf7e-68b27633ed68] pool-1-thread-1:execute node name:查询用户信息 [I]2022/07/27 21:23:16.003 [your flow id][38f3567d-77fb-4629-bf7e-68b27633ed68] pool-1-thread-2:execute node id:1a90a997-4390-470a-ae7c-626a725438d2 查询用户信息开始 (模拟业务等待3秒) [I]2022/07/27 21:23:16.004 [your flow id][38f3567d-77fb-4629-bf7e-68b27633ed68] pool-1-thread-2:execute node name:查询酒店信息 查询酒店信息开始 (模拟业务等待3秒) 查询酒店信息结束 查询用户信息结束 [I]2022/07/27 21:23:19.008 [your flow id][38f3567d-77fb-4629-bf7e-68b27633ed68] pool-1-thread-1:execute node id:52289e99-363d-4453-8077-ca8bdc6d35bf [I]2022/07/27 21:23:19.008 [your flow id][38f3567d-77fb-4629-bf7e-68b27633ed68] pool-1-thread-1:execute node name:下单 下单开始 (模拟业务等待3秒) 下单结束 [I]2022/07/27 21:23:22.014 [your flow id][38f3567d-77fb-4629-bf7e-68b27633ed68] pool-1-thread-1:execute node id:16422cbb-ccb0-4fe2-952b-e3ad5c3acbb2 [I]2022/07/27 21:23:22.014 [your flow id][38f3567d-77fb-4629-bf7e-68b27633ed68] pool-1-thread-1:execute node name:下单成功 下单成功开始 (模拟业务等待3秒) 下单成功结束 [I]2022/07/27 21:23:25.025 [your flow id][38f3567d-77fb-4629-bf7e-68b27633ed68] Thread-1:Complete success. [I]2022/07/27 21:23:25.027 [your flow id][38f3567d-77fb-4629-bf7e-68b27633ed68] Thread-1:json: {"nodes":[{"id": "1","label": "start" ,"color": "#36AE7C"},{"id": "a1a38c2e-0e05-4c68-bd49-f12aea070876","label": "查询用户信息" ,"color": "#36AE7C"},{"id": "1a90a997-4390-470a-ae7c-626a725438d2","label": "查询酒店信息" ,"color": "#36AE7C"},{"id": "52289e99-363d-4453-8077-ca8bdc6d35bf","label": "下单" ,"color": "#36AE7C"},{"id": "16422cbb-ccb0-4fe2-952b-e3ad5c3acbb2","label": "下单成功" ,"color": "#36AE7C"}],"edges":[{"id": "1","from": "1","to": "2","arrows": "to"},{"id": "b3ad7ab3-8fb6-4527-8cae-6845e03da3e4","from": "1","to": "a1a38c2e-0e05-4c68-bd49-f12aea070876","arrows": "to"},{"id": "001375c7-19e7-436b-bbcd-68e36c8f23b7","from": "1","to": "1a90a997-4390-470a-ae7c-626a725438d2","arrows": "to"},{"id": "dd830043-c7a7-4c71-b91c-10c007b7b19c","from": "1a90a997-4390-470a-ae7c-626a725438d2","to": "52289e99-363d-4453-8077-ca8bdc6d35bf","arrows": "to"},{"id": "21c2c69d-0050-4eca-8283-5a2bcbdc6c37","from": "52289e99-363d-4453-8077-ca8bdc6d35bf","to": "16422cbb-ccb0-4fe2-952b-e3ad5c3acbb2","arrows": "to"},{"id": "19f2f329-8163-4dc6-a353-800df79d18a6","from": "a1a38c2e-0e05-4c68-bd49-f12aea070876","to": "52289e99-363d-4453-8077-ca8bdc6d35bf","arrows": "to"}]} success [I]2022/07/27 21:23:25.028  main:Ready queue thread stoped. [I]2022/07/27 21:23:25.028  main:Ready queue thread stoped. [I]2022/07/27 21:23:25.028  main:NodePool stoped.

将流程运行结束的json字符串拷贝到下面,然后点击[show network]按钮,可以显示出流程执行后的状态

绿色:执行成功,红色:执行失败,白色:未执行

业务可视化-让你的流程图&quot;Run&quot;起来(4.实际业务场景测试)

带分支处理的酒店预定流程

ladybugflow提供了对流程图的分支处理功能。

可以根据节点的返回结果,执行不同的流程。

比如,上例中,增加【检查订单】节点,如下

业务可视化-让你的流程图&quot;Run&quot;起来(4.实际业务场景测试)

 

 

检查订单成功,则走酒店预定流程,否则,走失败流程。

针对以上流程,我们对检查订单的两个边设置返回值,如下:

业务可视化-让你的流程图&quot;Run&quot;起来(4.实际业务场景测试)

业务可视化-让你的流程图&quot;Run&quot;起来(4.实际业务场景测试)

生成的Json文件如下

Flow2.json(注意文件编码为UTF-8)

{ 	"flowId": "your flow id", 	"nodes": [ 		{ 			"id": "1", 			"label": "start" 		}, 		{ 			"id": "a1a38c2e-0e05-4c68-bd49-f12aea070876", 			"label": "查询用户信息", 			"readyCheck": 0 		}, 		{ 			"id": "1a90a997-4390-470a-ae7c-626a725438d2", 			"label": "查询酒店信息", 			"readyCheck": 0 		}, 		{ 			"id": "52289e99-363d-4453-8077-ca8bdc6d35bf", 			"label": "下单", 			"readyCheck": 0 		}, 		{ 			"id": "16422cbb-ccb0-4fe2-952b-e3ad5c3acbb2", 			"label": "下单成功", 			"readyCheck": 0 		}, 		{ 			"id": "5a1068c1-e365-4a51-b617-8cc093ce5e3d", 			"label": "检查订单", 			"readyCheck": 0 		}, 		{ 			"id": "0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10", 			"label": "可以预定", 			"readyCheck": 0 		}, 		{ 			"id": "7e841bf6-b422-4c2c-b4ec-d2352e22cc88", 			"label": "不可预定", 			"readyCheck": 0 		}, 		{ 			"id": "8fc59321-8b96-4e17-9d8e-0c8f5fe9c45e", 			"label": "失败处理", 			"readyCheck": 0 		} 	], 	"edges": [ 		{ 			"id": "1", 			"from": "1", 			"to": "2", 			"arrows": "to" 		}, 		{ 			"id": "b3ad7ab3-8fb6-4527-8cae-6845e03da3e4", 			"from": "0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10", 			"to": "a1a38c2e-0e05-4c68-bd49-f12aea070876", 			"arrows": "to" 		}, 		{ 			"id": "001375c7-19e7-436b-bbcd-68e36c8f23b7", 			"from": "5a1068c1-e365-4a51-b617-8cc093ce5e3d", 			"to": "0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10", 			"condition": "1", 			"arrows": "to" 		}, 		{ 			"id": "dd830043-c7a7-4c71-b91c-10c007b7b19c", 			"from": "1a90a997-4390-470a-ae7c-626a725438d2", 			"to": "52289e99-363d-4453-8077-ca8bdc6d35bf", 			"arrows": "to" 		}, 		{ 			"id": "21c2c69d-0050-4eca-8283-5a2bcbdc6c37", 			"from": "52289e99-363d-4453-8077-ca8bdc6d35bf", 			"to": "16422cbb-ccb0-4fe2-952b-e3ad5c3acbb2", 			"arrows": "to" 		}, 		{ 			"id": "19f2f329-8163-4dc6-a353-800df79d18a6", 			"from": "a1a38c2e-0e05-4c68-bd49-f12aea070876", 			"to": "52289e99-363d-4453-8077-ca8bdc6d35bf", 			"arrows": "to" 		}, 		{ 			"id": "822e5c76-ce59-4962-b5e3-a3dfd905fa05", 			"from": "1", 			"to": "5a1068c1-e365-4a51-b617-8cc093ce5e3d", 			"arrows": "to" 		}, 		{ 			"id": "36d6e697-b835-4374-9fa7-c1cd24b100e9", 			"from": "5a1068c1-e365-4a51-b617-8cc093ce5e3d", 			"to": "7e841bf6-b422-4c2c-b4ec-d2352e22cc88", 			"condition": "0", 			"arrows": "to" 		}, 		{ 			"id": "d4a03a18-2a24-4bec-9717-a82c8a4a764b", 			"from": "0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10", 			"to": "1a90a997-4390-470a-ae7c-626a725438d2", 			"arrows": "to" 		}, 		{ 			"id": "673051d5-27f5-4578-8fc2-4f5e7352d5d2", 			"from": "7e841bf6-b422-4c2c-b4ec-d2352e22cc88", 			"to": "8fc59321-8b96-4e17-9d8e-0c8f5fe9c45e", 			"arrows": "to" 		} 	] }

业务方法中增加酒店检查节点,这里返回1,走检查成功的流程。

Flow2.java(注意文件编码为UTF-8)

/**  *   * @author NoBugLady  *  */ public class Flow2 extends FlowRunner {  	private String result; 	 	public String getResult() { 		return result; 	} 	 	@Node(label = "start") 	public void processStart() throws InterruptedException { 		System.out.println("启动开始 (模拟业务等待3秒)"); 		Thread.sleep(3000); 		System.out.println("启动结束"); 	}  	@Node(label = "检查订单") 	public int processCheckOrder() throws InterruptedException { 		System.out.println("检查订单开始 (模拟业务等待3秒)"); 		Thread.sleep(3000); 		System.out.println("检查订单结束"); 		return 1; 	}  	@Node(label = "可以预定") 	public void processCheckOrderOK() throws InterruptedException { 		System.out.println("可以预定开始 (模拟业务等待3秒)"); 		Thread.sleep(3000); 		System.out.println("可以预定结束"); 	}  	@Node(label = "不可预订") 	public void processCheckOrderNG() throws InterruptedException { 		System.out.println("不可预订开始 (模拟业务等待3秒)"); 		Thread.sleep(3000); 		System.out.println("不可预订结束"); 	} 	 	@Node(label = "查询用户信息") 	public void processSearchUser() throws InterruptedException { 		System.out.println("查询用户信息开始 (模拟业务等待3秒)"); 		Thread.sleep(3000); 		System.out.println("查询用户信息结束"); 	}  	@Node(label = "查询酒店信息") 	public void processSearchHotel() throws InterruptedException { 		System.out.println("查询酒店信息开始 (模拟业务等待3秒)"); 		Thread.sleep(3000); 		System.out.println("查询酒店信息结束"); 	}  	@Node(label = "下单") 	public void processOrder() throws InterruptedException { 		System.out.println("下单开始 (模拟业务等待3秒)"); 		Thread.sleep(3000); 		System.out.println("下单结束"); 	}  	@Node(label = "下单成功") 	public void processSuccess() throws InterruptedException { 		System.out.println("下单成功开始 (模拟业务等待3秒)"); 		Thread.sleep(3000); 		System.out.println("下单成功结束"); 		result = "success"; 	}  	@Node(label = "失败处理") 	public void processError() throws InterruptedException { 		System.out.println("失败处理开始 (模拟业务等待3秒)"); 		Thread.sleep(3000); 		System.out.println("失败处理结束"); 		result = "error"; 	} }

启动流程

App2.java(注意文件编码为UTF-8)

/**  *   * @author NoBugLady  *  */ public class App2 {  	public static void main(String[] args) { 		 		Flow2 testFlow = new Flow2(); 		testFlow.startFlow(true); 		 		System.out.println(testFlow.getResult());  		// 不建议每次都调用shutdown,可以在整个App关闭的时候调用一次shutdown 		FlowStarter.shutdown(); 		 	} }

查看运行结果

[I]2022/07/27 21:29:56.046  main:ladybugflow.properties in root path not found, use default configuration [I]2022/07/27 21:29:56.052  main:NodePool started. [I]2022/07/27 21:29:56.052  main:Ready queue consumer thread started. [I]2022/07/27 21:29:56.054  main:Complete queue consumer thread started. [I]2022/07/27 21:29:56.927 [your flow id][73a425a8-2f13-42bc-9358-111d10378204] main:json: {"flowId":"your flow id","nodes":[{"id":"1","label":"start","readyCheck":0},{"id":"a1a38c2e-0e05-4c68-bd49-f12aea070876","label":"查询用户信息","readyCheck":0},{"id":"1a90a997-4390-470a-ae7c-626a725438d2","label":"查询酒店信息","readyCheck":0},{"id":"52289e99-363d-4453-8077-ca8bdc6d35bf","label":"下单","readyCheck":0},{"id":"16422cbb-ccb0-4fe2-952b-e3ad5c3acbb2","label":"下单成功","readyCheck":0},{"id":"5a1068c1-e365-4a51-b617-8cc093ce5e3d","label":"检查订单","readyCheck":0},{"id":"0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10","label":"可以预定","readyCheck":0},{"id":"7e841bf6-b422-4c2c-b4ec-d2352e22cc88","label":"不可预定","readyCheck":0},{"id":"8fc59321-8b96-4e17-9d8e-0c8f5fe9c45e","label":"失败处理","readyCheck":0}],"edges":[{"id":"1","from":"1","to":"2","condition":null,"arrows":"to"},{"id":"b3ad7ab3-8fb6-4527-8cae-6845e03da3e4","from":"0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10","to":"a1a38c2e-0e05-4c68-bd49-f12aea070876","condition":null,"arrows":"to"},{"id":"001375c7-19e7-436b-bbcd-68e36c8f23b7","from":"5a1068c1-e365-4a51-b617-8cc093ce5e3d","to":"0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10","condition":"1","arrows":"to"},{"id":"dd830043-c7a7-4c71-b91c-10c007b7b19c","from":"1a90a997-4390-470a-ae7c-626a725438d2","to":"52289e99-363d-4453-8077-ca8bdc6d35bf","condition":null,"arrows":"to"},{"id":"21c2c69d-0050-4eca-8283-5a2bcbdc6c37","from":"52289e99-363d-4453-8077-ca8bdc6d35bf","to":"16422cbb-ccb0-4fe2-952b-e3ad5c3acbb2","condition":null,"arrows":"to"},{"id":"19f2f329-8163-4dc6-a353-800df79d18a6","from":"a1a38c2e-0e05-4c68-bd49-f12aea070876","to":"52289e99-363d-4453-8077-ca8bdc6d35bf","condition":null,"arrows":"to"},{"id":"822e5c76-ce59-4962-b5e3-a3dfd905fa05","from":"1","to":"5a1068c1-e365-4a51-b617-8cc093ce5e3d","condition":null,"arrows":"to"},{"id":"36d6e697-b835-4374-9fa7-c1cd24b100e9","from":"5a1068c1-e365-4a51-b617-8cc093ce5e3d","to":"7e841bf6-b422-4c2c-b4ec-d2352e22cc88","condition":"0","arrows":"to"},{"id":"d4a03a18-2a24-4bec-9717-a82c8a4a764b","from":"0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10","to":"1a90a997-4390-470a-ae7c-626a725438d2","condition":null,"arrows":"to"},{"id":"673051d5-27f5-4578-8fc2-4f5e7352d5d2","from":"7e841bf6-b422-4c2c-b4ec-d2352e22cc88","to":"8fc59321-8b96-4e17-9d8e-0c8f5fe9c45e","condition":null,"arrows":"to"}]} [I]2022/07/27 21:29:56.931 [your flow id][73a425a8-2f13-42bc-9358-111d10378204] pool-1-thread-1:execute node id:1 [I]2022/07/27 21:29:56.931 [your flow id][73a425a8-2f13-42bc-9358-111d10378204] pool-1-thread-1:execute node name:start 启动开始 (模拟业务等待3秒) 启动结束 [I]2022/07/27 21:29:59.939 [your flow id][73a425a8-2f13-42bc-9358-111d10378204] pool-1-thread-1:execute node id:5a1068c1-e365-4a51-b617-8cc093ce5e3d [I]2022/07/27 21:29:59.939 [your flow id][73a425a8-2f13-42bc-9358-111d10378204] pool-1-thread-1:execute node name:检查订单 检查订单开始 (模拟业务等待3秒) 检查订单结束 [I]2022/07/27 21:30:02.942 [your flow id][73a425a8-2f13-42bc-9358-111d10378204] pool-1-thread-1:execute node id:0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10 [I]2022/07/27 21:30:02.942 [your flow id][73a425a8-2f13-42bc-9358-111d10378204] pool-1-thread-1:execute node name:可以预定 可以预定开始 (模拟业务等待3秒) 可以预定结束 [I]2022/07/27 21:30:05.950 [your flow id][73a425a8-2f13-42bc-9358-111d10378204] pool-1-thread-1:execute node id:a1a38c2e-0e05-4c68-bd49-f12aea070876 [I]2022/07/27 21:30:05.950 [your flow id][73a425a8-2f13-42bc-9358-111d10378204] pool-1-thread-1:execute node name:查询用户信息 查询用户信息开始 (模拟业务等待3秒) [I]2022/07/27 21:30:05.951 [your flow id][73a425a8-2f13-42bc-9358-111d10378204] pool-1-thread-2:execute node id:1a90a997-4390-470a-ae7c-626a725438d2 [I]2022/07/27 21:30:05.951 [your flow id][73a425a8-2f13-42bc-9358-111d10378204] pool-1-thread-2:execute node name:查询酒店信息 查询酒店信息开始 (模拟业务等待3秒) 查询酒店信息结束 查询用户信息结束 [I]2022/07/27 21:30:08.956 [your flow id][73a425a8-2f13-42bc-9358-111d10378204] pool-1-thread-1:execute node id:52289e99-363d-4453-8077-ca8bdc6d35bf [I]2022/07/27 21:30:08.956 [your flow id][73a425a8-2f13-42bc-9358-111d10378204] pool-1-thread-1:execute node name:下单 下单开始 (模拟业务等待3秒) 下单结束 [I]2022/07/27 21:30:11.960 [your flow id][73a425a8-2f13-42bc-9358-111d10378204] pool-1-thread-1:execute node id:16422cbb-ccb0-4fe2-952b-e3ad5c3acbb2 [I]2022/07/27 21:30:11.960 [your flow id][73a425a8-2f13-42bc-9358-111d10378204] pool-1-thread-1:execute node name:下单成功 下单成功开始 (模拟业务等待3秒) 下单成功结束 [I]2022/07/27 21:30:14.975 [your flow id][73a425a8-2f13-42bc-9358-111d10378204] Thread-1:Complete success. [I]2022/07/27 21:30:14.977 [your flow id][73a425a8-2f13-42bc-9358-111d10378204] Thread-1:json: {"nodes":[{"id": "1","label": "start" ,"color": "#36AE7C"},{"id": "a1a38c2e-0e05-4c68-bd49-f12aea070876","label": "查询用户信息" ,"color": "#36AE7C"},{"id": "1a90a997-4390-470a-ae7c-626a725438d2","label": "查询酒店信息" ,"color": "#36AE7C"},{"id": "52289e99-363d-4453-8077-ca8bdc6d35bf","label": "下单" ,"color": "#36AE7C"},{"id": "16422cbb-ccb0-4fe2-952b-e3ad5c3acbb2","label": "下单成功" ,"color": "#36AE7C"},{"id": "5a1068c1-e365-4a51-b617-8cc093ce5e3d","label": "检查订单" ,"color": "#36AE7C"},{"id": "0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10","label": "可以预定" ,"color": "#36AE7C"},{"id": "7e841bf6-b422-4c2c-b4ec-d2352e22cc88","label": "不可预定" ,"color": "#E8F9FD"},{"id": "8fc59321-8b96-4e17-9d8e-0c8f5fe9c45e","label": "失败处理" ,"color": "#E8F9FD"}],"edges":[{"id": "1","from": "1","to": "2","arrows": "to"},{"id": "b3ad7ab3-8fb6-4527-8cae-6845e03da3e4","from": "0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10","to": "a1a38c2e-0e05-4c68-bd49-f12aea070876","arrows": "to"},{"id": "001375c7-19e7-436b-bbcd-68e36c8f23b7","from": "5a1068c1-e365-4a51-b617-8cc093ce5e3d","to": "0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10","arrows": "to"},{"id": "dd830043-c7a7-4c71-b91c-10c007b7b19c","from": "1a90a997-4390-470a-ae7c-626a725438d2","to": "52289e99-363d-4453-8077-ca8bdc6d35bf","arrows": "to"},{"id": "21c2c69d-0050-4eca-8283-5a2bcbdc6c37","from": "52289e99-363d-4453-8077-ca8bdc6d35bf","to": "16422cbb-ccb0-4fe2-952b-e3ad5c3acbb2","arrows": "to"},{"id": "19f2f329-8163-4dc6-a353-800df79d18a6","from": "a1a38c2e-0e05-4c68-bd49-f12aea070876","to": "52289e99-363d-4453-8077-ca8bdc6d35bf","arrows": "to"},{"id": "822e5c76-ce59-4962-b5e3-a3dfd905fa05","from": "1","to": "5a1068c1-e365-4a51-b617-8cc093ce5e3d","arrows": "to"},{"id": "36d6e697-b835-4374-9fa7-c1cd24b100e9","from": "5a1068c1-e365-4a51-b617-8cc093ce5e3d","to": "7e841bf6-b422-4c2c-b4ec-d2352e22cc88","arrows": "to"},{"id": "d4a03a18-2a24-4bec-9717-a82c8a4a764b","from": "0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10","to": "1a90a997-4390-470a-ae7c-626a725438d2","arrows": "to"},{"id": "673051d5-27f5-4578-8fc2-4f5e7352d5d2","from": "7e841bf6-b422-4c2c-b4ec-d2352e22cc88","to": "8fc59321-8b96-4e17-9d8e-0c8f5fe9c45e","arrows": "to"}]} success [I]2022/07/27 21:30:14.977  main:Ready queue thread stoped. [I]2022/07/27 21:30:14.977  main:Ready queue thread stoped. [I]2022/07/27 21:30:14.977  main:NodePool stoped.

将流程运行结束的json字符串拷贝到下面,然后点击[show network]按钮,可以显示出流程执行后的状态

绿色:执行成功,红色:执行失败,白色:未执行

业务可视化-让你的流程图&quot;Run&quot;起来(4.实际业务场景测试)

去除不必要的业务节点

实际使用过程中,并非每个业务节点都需要对应业务代码,

比如上例中【可以预定】和【不可预定】可以没有相应的业务逻辑,空跑一下转到后面的节点即可。

所以,我们可以在业务逻辑中去掉上述节点,如下,去掉了【可以预定】和【不可预定】对应的业务方法。

Flow3.java(注意文件编码为UTF-8)

 /**  *   * @author NoBugLady  *  */ public class Flow3 extends FlowRunner {  	private String result; 	 	public String getResult() { 		return result; 	} 	 	@Node(label = "start") 	public void processStart() throws InterruptedException { 		System.out.println("启动开始 (模拟业务等待3秒)"); 		Thread.sleep(3000); 		System.out.println("启动结束"); 	}  	@Node(label = "检查订单") 	public int processCheckOrder() throws InterruptedException { 		System.out.println("检查订单开始 (模拟业务等待3秒)"); 		Thread.sleep(3000); 		System.out.println("检查订单结束"); 		return 1; 	}  	@Node(label = "查询用户信息") 	public void processSearchUser() throws InterruptedException { 		System.out.println("查询用户信息开始 (模拟业务等待3秒)"); 		Thread.sleep(3000); 		System.out.println("查询用户信息结束"); 	}  	@Node(label = "查询酒店信息") 	public void processSearchHotel() throws InterruptedException { 		System.out.println("查询酒店信息开始 (模拟业务等待3秒)"); 		Thread.sleep(3000); 		System.out.println("查询酒店信息结束"); 	}  	@Node(label = "下单") 	public void processOrder() throws InterruptedException { 		System.out.println("下单开始 (模拟业务等待3秒)"); 		Thread.sleep(3000); 		System.out.println("下单结束"); 	}  	@Node(label = "下单成功") 	public void processSuccess() throws InterruptedException { 		System.out.println("下单成功开始 (模拟业务等待3秒)"); 		Thread.sleep(3000); 		System.out.println("下单成功结束"); 		result = "success"; 	}  	@Node(label = "失败处理") 	public void processError() throws InterruptedException { 		System.out.println("失败处理开始 (模拟业务等待3秒)"); 		Thread.sleep(3000); 		System.out.println("失败处理结束"); 		result = "error"; 	} }

启动代码和流程配置文件不变

App3.java(注意文件编码为UTF-8)

/**  *   * @author NoBugLady  *  */ public class App3 {  	public static void main(String[] args) { 		 		Flow3 testFlow = new Flow3(); 		testFlow.startFlow(true); 		 		System.out.println(testFlow.getResult());          		// 不建议每次都调用shutdown,可以在整个App关闭的时候调用一次shutdown 		FlowStarter.shutdown(); 		 	} }

Flow3.json(注意文件编码为UTF-8)

{ 	"flowId": "your flow id", 	"nodes": [ 		{ 			"id": "1", 			"label": "start" 		}, 		{ 			"id": "a1a38c2e-0e05-4c68-bd49-f12aea070876", 			"label": "查询用户信息", 			"readyCheck": 0 		}, 		{ 			"id": "1a90a997-4390-470a-ae7c-626a725438d2", 			"label": "查询酒店信息", 			"readyCheck": 0 		}, 		{ 			"id": "52289e99-363d-4453-8077-ca8bdc6d35bf", 			"label": "下单", 			"readyCheck": 0 		}, 		{ 			"id": "16422cbb-ccb0-4fe2-952b-e3ad5c3acbb2", 			"label": "下单成功", 			"readyCheck": 0 		}, 		{ 			"id": "5a1068c1-e365-4a51-b617-8cc093ce5e3d", 			"label": "检查订单", 			"readyCheck": 0 		}, 		{ 			"id": "0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10", 			"label": "可以预定", 			"readyCheck": 0 		}, 		{ 			"id": "7e841bf6-b422-4c2c-b4ec-d2352e22cc88", 			"label": "不可预定", 			"readyCheck": 0 		}, 		{ 			"id": "8fc59321-8b96-4e17-9d8e-0c8f5fe9c45e", 			"label": "失败处理", 			"readyCheck": 0 		} 	], 	"edges": [ 		{ 			"id": "1", 			"from": "1", 			"to": "2", 			"arrows": "to" 		}, 		{ 			"id": "b3ad7ab3-8fb6-4527-8cae-6845e03da3e4", 			"from": "0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10", 			"to": "a1a38c2e-0e05-4c68-bd49-f12aea070876", 			"arrows": "to" 		}, 		{ 			"id": "001375c7-19e7-436b-bbcd-68e36c8f23b7", 			"from": "5a1068c1-e365-4a51-b617-8cc093ce5e3d", 			"to": "0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10", 			"condition": "1", 			"arrows": "to" 		}, 		{ 			"id": "dd830043-c7a7-4c71-b91c-10c007b7b19c", 			"from": "1a90a997-4390-470a-ae7c-626a725438d2", 			"to": "52289e99-363d-4453-8077-ca8bdc6d35bf", 			"arrows": "to" 		}, 		{ 			"id": "21c2c69d-0050-4eca-8283-5a2bcbdc6c37", 			"from": "52289e99-363d-4453-8077-ca8bdc6d35bf", 			"to": "16422cbb-ccb0-4fe2-952b-e3ad5c3acbb2", 			"arrows": "to" 		}, 		{ 			"id": "19f2f329-8163-4dc6-a353-800df79d18a6", 			"from": "a1a38c2e-0e05-4c68-bd49-f12aea070876", 			"to": "52289e99-363d-4453-8077-ca8bdc6d35bf", 			"arrows": "to" 		}, 		{ 			"id": "822e5c76-ce59-4962-b5e3-a3dfd905fa05", 			"from": "1", 			"to": "5a1068c1-e365-4a51-b617-8cc093ce5e3d", 			"arrows": "to" 		}, 		{ 			"id": "36d6e697-b835-4374-9fa7-c1cd24b100e9", 			"from": "5a1068c1-e365-4a51-b617-8cc093ce5e3d", 			"to": "7e841bf6-b422-4c2c-b4ec-d2352e22cc88", 			"condition": "0", 			"arrows": "to" 		}, 		{ 			"id": "d4a03a18-2a24-4bec-9717-a82c8a4a764b", 			"from": "0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10", 			"to": "1a90a997-4390-470a-ae7c-626a725438d2", 			"arrows": "to" 		}, 		{ 			"id": "673051d5-27f5-4578-8fc2-4f5e7352d5d2", 			"from": "7e841bf6-b422-4c2c-b4ec-d2352e22cc88", 			"to": "8fc59321-8b96-4e17-9d8e-0c8f5fe9c45e", 			"arrows": "to" 		} 	] }

运行结果

[I]2022/07/27 21:34:29.548  main:ladybugflow.properties in root path not found, use default configuration [I]2022/07/27 21:34:29.558  main:NodePool started. [I]2022/07/27 21:34:29.560  main:Ready queue consumer thread started. [I]2022/07/27 21:34:29.563  main:Complete queue consumer thread started. [I]2022/07/27 21:34:30.494 [your flow id][970f3310-4ca1-41db-9348-bcc3fe994ce5] main:json: {"flowId":"your flow id","nodes":[{"id":"1","label":"start","readyCheck":0},{"id":"a1a38c2e-0e05-4c68-bd49-f12aea070876","label":"查询用户信息","readyCheck":0},{"id":"1a90a997-4390-470a-ae7c-626a725438d2","label":"查询酒店信息","readyCheck":0},{"id":"52289e99-363d-4453-8077-ca8bdc6d35bf","label":"下单","readyCheck":0},{"id":"16422cbb-ccb0-4fe2-952b-e3ad5c3acbb2","label":"下单成功","readyCheck":0},{"id":"5a1068c1-e365-4a51-b617-8cc093ce5e3d","label":"检查订单","readyCheck":0},{"id":"0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10","label":"可以预定","readyCheck":0},{"id":"7e841bf6-b422-4c2c-b4ec-d2352e22cc88","label":"不可预定","readyCheck":0},{"id":"8fc59321-8b96-4e17-9d8e-0c8f5fe9c45e","label":"失败处理","readyCheck":0}],"edges":[{"id":"1","from":"1","to":"2","condition":null,"arrows":"to"},{"id":"b3ad7ab3-8fb6-4527-8cae-6845e03da3e4","from":"0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10","to":"a1a38c2e-0e05-4c68-bd49-f12aea070876","condition":null,"arrows":"to"},{"id":"001375c7-19e7-436b-bbcd-68e36c8f23b7","from":"5a1068c1-e365-4a51-b617-8cc093ce5e3d","to":"0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10","condition":"1","arrows":"to"},{"id":"dd830043-c7a7-4c71-b91c-10c007b7b19c","from":"1a90a997-4390-470a-ae7c-626a725438d2","to":"52289e99-363d-4453-8077-ca8bdc6d35bf","condition":null,"arrows":"to"},{"id":"21c2c69d-0050-4eca-8283-5a2bcbdc6c37","from":"52289e99-363d-4453-8077-ca8bdc6d35bf","to":"16422cbb-ccb0-4fe2-952b-e3ad5c3acbb2","condition":null,"arrows":"to"},{"id":"19f2f329-8163-4dc6-a353-800df79d18a6","from":"a1a38c2e-0e05-4c68-bd49-f12aea070876","to":"52289e99-363d-4453-8077-ca8bdc6d35bf","condition":null,"arrows":"to"},{"id":"822e5c76-ce59-4962-b5e3-a3dfd905fa05","from":"1","to":"5a1068c1-e365-4a51-b617-8cc093ce5e3d","condition":null,"arrows":"to"},{"id":"36d6e697-b835-4374-9fa7-c1cd24b100e9","from":"5a1068c1-e365-4a51-b617-8cc093ce5e3d","to":"7e841bf6-b422-4c2c-b4ec-d2352e22cc88","condition":"0","arrows":"to"},{"id":"d4a03a18-2a24-4bec-9717-a82c8a4a764b","from":"0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10","to":"1a90a997-4390-470a-ae7c-626a725438d2","condition":null,"arrows":"to"},{"id":"673051d5-27f5-4578-8fc2-4f5e7352d5d2","from":"7e841bf6-b422-4c2c-b4ec-d2352e22cc88","to":"8fc59321-8b96-4e17-9d8e-0c8f5fe9c45e","condition":null,"arrows":"to"}]} [I]2022/07/27 21:34:30.497 [your flow id][970f3310-4ca1-41db-9348-bcc3fe994ce5] pool-1-thread-1:execute node id:1 [I]2022/07/27 21:34:30.498 [your flow id][970f3310-4ca1-41db-9348-bcc3fe994ce5] pool-1-thread-1:execute node name:start 启动开始 (模拟业务等待3秒) 启动结束 [I]2022/07/27 21:34:33.502 [your flow id][970f3310-4ca1-41db-9348-bcc3fe994ce5] pool-1-thread-1:execute node id:5a1068c1-e365-4a51-b617-8cc093ce5e3d [I]2022/07/27 21:34:33.503 [your flow id][970f3310-4ca1-41db-9348-bcc3fe994ce5] pool-1-thread-1:execute node name:检查订单 检查订单开始 (模拟业务等待3秒) 检查订单结束 [I]2022/07/27 21:34:36.518 [your flow id][970f3310-4ca1-41db-9348-bcc3fe994ce5] pool-1-thread-1:execute node id:0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10 [I]2022/07/27 21:34:36.518 [your flow id][970f3310-4ca1-41db-9348-bcc3fe994ce5] pool-1-thread-1:execute node name:可以预定 [I]2022/07/27 21:34:36.519 [your flow id][970f3310-4ca1-41db-9348-bcc3fe994ce5] pool-1-thread-1:execute node id:a1a38c2e-0e05-4c68-bd49-f12aea070876 [I]2022/07/27 21:34:36.519 [your flow id][970f3310-4ca1-41db-9348-bcc3fe994ce5] pool-1-thread-1:execute node name:查询用户信息 查询用户信息开始 (模拟业务等待3秒) [I]2022/07/27 21:34:36.519 [your flow id][970f3310-4ca1-41db-9348-bcc3fe994ce5] pool-1-thread-2:execute node id:1a90a997-4390-470a-ae7c-626a725438d2 [I]2022/07/27 21:34:36.519 [your flow id][970f3310-4ca1-41db-9348-bcc3fe994ce5] pool-1-thread-2:execute node name:查询酒店信息 查询酒店信息开始 (模拟业务等待3秒) 查询用户信息结束 查询酒店信息结束 [I]2022/07/27 21:34:39.522 [your flow id][970f3310-4ca1-41db-9348-bcc3fe994ce5] pool-1-thread-2:execute node id:52289e99-363d-4453-8077-ca8bdc6d35bf [I]2022/07/27 21:34:39.522 [your flow id][970f3310-4ca1-41db-9348-bcc3fe994ce5] pool-1-thread-2:execute node name:下单 下单开始 (模拟业务等待3秒) 下单结束 [I]2022/07/27 21:34:42.529 [your flow id][970f3310-4ca1-41db-9348-bcc3fe994ce5] pool-1-thread-2:execute node id:16422cbb-ccb0-4fe2-952b-e3ad5c3acbb2 [I]2022/07/27 21:34:42.529 [your flow id][970f3310-4ca1-41db-9348-bcc3fe994ce5] pool-1-thread-2:execute node name:下单成功 下单成功开始 (模拟业务等待3秒) 下单成功结束 [I]2022/07/27 21:34:45.530 [your flow id][970f3310-4ca1-41db-9348-bcc3fe994ce5] Thread-1:Complete success. [I]2022/07/27 21:34:45.532 [your flow id][970f3310-4ca1-41db-9348-bcc3fe994ce5] Thread-1:json: {"nodes":[{"id": "1","label": "start" ,"color": "#36AE7C"},{"id": "a1a38c2e-0e05-4c68-bd49-f12aea070876","label": "查询用户信息" ,"color": "#36AE7C"},{"id": "1a90a997-4390-470a-ae7c-626a725438d2","label": "查询酒店信息" ,"color": "#36AE7C"},{"id": "52289e99-363d-4453-8077-ca8bdc6d35bf","label": "下单" ,"color": "#36AE7C"},{"id": "16422cbb-ccb0-4fe2-952b-e3ad5c3acbb2","label": "下单成功" ,"color": "#36AE7C"},{"id": "5a1068c1-e365-4a51-b617-8cc093ce5e3d","label": "检查订单" ,"color": "#36AE7C"},{"id": "0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10","label": "可以预定" ,"color": "#36AE7C"},{"id": "7e841bf6-b422-4c2c-b4ec-d2352e22cc88","label": "不可预定" ,"color": "#E8F9FD"},{"id": "8fc59321-8b96-4e17-9d8e-0c8f5fe9c45e","label": "失败处理" ,"color": "#E8F9FD"}],"edges":[{"id": "1","from": "1","to": "2","arrows": "to"},{"id": "b3ad7ab3-8fb6-4527-8cae-6845e03da3e4","from": "0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10","to": "a1a38c2e-0e05-4c68-bd49-f12aea070876","arrows": "to"},{"id": "001375c7-19e7-436b-bbcd-68e36c8f23b7","from": "5a1068c1-e365-4a51-b617-8cc093ce5e3d","to": "0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10","arrows": "to"},{"id": "dd830043-c7a7-4c71-b91c-10c007b7b19c","from": "1a90a997-4390-470a-ae7c-626a725438d2","to": "52289e99-363d-4453-8077-ca8bdc6d35bf","arrows": "to"},{"id": "21c2c69d-0050-4eca-8283-5a2bcbdc6c37","from": "52289e99-363d-4453-8077-ca8bdc6d35bf","to": "16422cbb-ccb0-4fe2-952b-e3ad5c3acbb2","arrows": "to"},{"id": "19f2f329-8163-4dc6-a353-800df79d18a6","from": "a1a38c2e-0e05-4c68-bd49-f12aea070876","to": "52289e99-363d-4453-8077-ca8bdc6d35bf","arrows": "to"},{"id": "822e5c76-ce59-4962-b5e3-a3dfd905fa05","from": "1","to": "5a1068c1-e365-4a51-b617-8cc093ce5e3d","arrows": "to"},{"id": "36d6e697-b835-4374-9fa7-c1cd24b100e9","from": "5a1068c1-e365-4a51-b617-8cc093ce5e3d","to": "7e841bf6-b422-4c2c-b4ec-d2352e22cc88","arrows": "to"},{"id": "d4a03a18-2a24-4bec-9717-a82c8a4a764b","from": "0aa3e9de-4015-4db0-9eda-fd1cd0fbbf10","to": "1a90a997-4390-470a-ae7c-626a725438d2","arrows": "to"},{"id": "673051d5-27f5-4578-8fc2-4f5e7352d5d2","from": "7e841bf6-b422-4c2c-b4ec-d2352e22cc88","to": "8fc59321-8b96-4e17-9d8e-0c8f5fe9c45e","arrows": "to"}]} success [I]2022/07/27 21:34:45.532  main:Ready queue thread stoped. [I]2022/07/27 21:34:45.532  main:Ready queue thread stoped. [I]2022/07/27 21:34:45.533  main:NodePool stoped.

将流程运行结束的json字符串拷贝到下面,然后点击[show network]按钮,可以显示出流程执行后的状态

绿色:执行成功,红色:执行失败,白色:未执行

业务可视化-让你的流程图&quot;Run&quot;起来(4.实际业务场景测试)

感谢您读文章到这里。

最后

设计资料和详细的使用方法可以参照上一篇文章:https://www.cnblogs.com/nobuglady/p/16474433.html

源码:https://github.com/nobuglady/ladybugflow

运行例源码:https://github.com/nobuglady/ladybugflow-demo

 

发表评论

相关文章