🍔快速上手
# 如何运行 Demo
克隆 Gobrs-Async 源代码 (opens new window)
启动 Gobrs-Async-Example (opens new window) 模块下 GobrsAsyncExampleApplication 应用类
通过接口修改线程池中的配置。HTTP GET 路径:http://localhost:8888/gobrs/testGobrs
,查看Idea 控制台 打印结果如下:
EService Begin
AService Begin
AService Finish
BService Begin
BService Finish
FService Begin
EService Finish
CService Begin
CService Finish
FService Finish
GService Begin
GService Finish
HService Begin
HService Finish
2022-11-27 19:08:51.080 INFO 61949 --- [nio-8888-exec-1] com.gobrs.async.core.TaskLoader : 【ProcessTrace】Total cost: 2536ms | traceId = 11702850586978176 | 【task】AService cost :302ms【state】:success; ->【task】BService cost :0ms【state】:success; ->【task】EService cost :602ms【state】:success; ->【task】CService cost :305ms【state】:success; ->【task】FService cost :2006ms【state】:success; ->【task】GService cost :105ms【state】:success; ->【task】HService cost :102ms【state】:success;
2551
# 执行过程
从日志中可以看出整个流程的执行过程
【ProcessTrace】Total cost: 2536ms | traceId = 11702850586978176 | 【task】AService cost :302ms【state】:success; ->【task】BService cost :0ms【state】:success; ->【task】EService cost :602ms【state】:success; ->【task】CService cost :305ms【state】:success; ->【task】FService cost :2006ms【state】:success; ->【task】GService cost :105ms【state】:success; ->【task】HService cost :102ms【state】:success;
- Total cost: 任务流程总耗时
- traceId: 任务流程链路id
- cost: 单个任务执行时间
# 配置文件
server:
port: 8888 # 端口: 8888
gobrs:
async:
config:
rules:
# 规则 是数组类型的 多组规则
- name: "general"
content: "AService->BService->FService->GService->HService;EService->CService;AService"
task-interrupt: false # 局部异常是否打断主流程 默认false
transaction: false
# 关闭Gobrs-Async
server:
port: 8888 # 端口: 8080
gobrs:
async:
enable: false # 关闭编排引擎
rules:
# 支持多命名空间
- name: "ruleName" # 规则名称
content: "AService->BService,CService,FService; BService->FService,GService;"
- name: "azh"
content: "AService->BService,CService,FService; BService->FService,GService;"
task-interrupt: false #局部异常是否打断主流程
Last Updated: 12/11/2022, 4:27:25 PM