From 76ffdb89ad623a8c91c0c354b649efe9a744179f Mon Sep 17 00:00:00 2001 From: dengqichen Date: Tue, 10 Dec 2024 18:06:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=AD=BB=E4=BF=A1=E9=98=9F?= =?UTF-8?q?=E5=88=97=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/README.md | 128 +++++++++++++++++- backend/pom.xml | 7 +- .../workflow/config/FlowableConfig.java | 20 +++ .../workflow/delegate/ShellTaskDelegate.java | 22 ++- .../impl/WorkflowDefinitionServiceImpl.java | 1 + backend/src/main/resources/application.yml | 15 ++ 6 files changed, 188 insertions(+), 5 deletions(-) diff --git a/backend/README.md b/backend/README.md index 276958cd..f5bad918 100644 --- a/backend/README.md +++ b/backend/README.md @@ -910,4 +910,130 @@ workflow_log(工作流日志表) 提供了更丰富的元数据和状态信息 支持更细粒度的日志记录 可以存储自定义的业务数据 -这样的设计让我们可以在使用Flowable强大的工作流引擎的同时,也能满足特定的业务需求。 \ No newline at end of file +这样的设计让我们可以在使用Flowable强大的工作流引擎的同时,也能满足特定的业务需求。 + + +{ + "name": "Simple Shell Workflow6", + "key": "simple_shell_workflow", + "description": "A simple workflow with shell task", + "graphJson": { + "cells": [ + { + "id": "start", + "shape": "start", + "data": { + "label": "开始" + }, + "position": { + "x": 100, + "y": 100 + } + }, + { + "id": "shell", + "shape": "serviceTask", + "data": { + "label": "Shell脚本", + "serviceTask": { + "type": "shell", + "implementation": "${shellTaskDelegate}", + "fields": { + "script": "timeout 10000000", + "workDir": "/tmp", + "env": { + "TEST_VAR": "test_value" + } + } + } + }, + "position": { + "x": 300, + "y": 100 + } + }, + { + "id": "shellErrorBoundary", + "shape": "boundaryEvent", + "data": { + "label": "Shell错误", + "boundaryEvent": { + "type": "error", + "attachedToRef": "shell", + "errorRef": "SHELL_EXECUTION_ERROR" + } + }, + "position": { + "x": 300, + "y": 160 + } + }, + { + "id": "errorHandler", + "shape": "serviceTask", + "data": { + "label": "错误处理", + "serviceTask": { + "type": "service", + "implementation": "${errorHandlerDelegate}" + } + }, + "position": { + "x": 300, + "y": 220 + } + }, + { + "id": "end", + "shape": "end", + "data": { + "label": "结束" + }, + "position": { + "x": 500, + "y": 100 + } + }, + { + "id": "flow1", + "shape": "edge", + "source": "start", + "target": "shell", + "data": { + "label": "流转到Shell" + } + }, + { + "id": "flow2", + "shape": "edge", + "source": "shell", + "target": "end", + "data": { + "label": "完成" + } + }, + { + "id": "flow_error", + "shape": "edge", + "source": "shellErrorBoundary", + "target": "errorHandler", + "data": { + "label": "错误处理" + } + }, + { + "id": "flow_error_end", + "shape": "edge", + "source": "errorHandler", + "target": "end", + "data": { + "label": "处理完成" + } + } + ] + } +} + +死信队列的问题: +需要再异常里直接移除: +runtimeService.deleteProcessInstance(processInstanceId, errorMessage); \ No newline at end of file diff --git a/backend/pom.xml b/backend/pom.xml index 28ff6804..ac48ac2c 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -70,7 +70,7 @@ mysql-connector-j runtime - + com.vladmihalcea @@ -220,6 +220,11 @@ flowable-bpmn-layout ${flowable.version} + + + + + diff --git a/backend/src/main/java/com/qqchen/deploy/backend/workflow/config/FlowableConfig.java b/backend/src/main/java/com/qqchen/deploy/backend/workflow/config/FlowableConfig.java index 3e869b5d..eb6f1f39 100644 --- a/backend/src/main/java/com/qqchen/deploy/backend/workflow/config/FlowableConfig.java +++ b/backend/src/main/java/com/qqchen/deploy/backend/workflow/config/FlowableConfig.java @@ -16,5 +16,25 @@ public class FlowableConfig implements EngineConfigurationConfigurer