From 8a1a4c1c6d84beb02b9e01eaba407d5d9a529847 Mon Sep 17 00:00:00 2001 From: wangli <274027703@qq.com> Date: Fri, 24 May 2024 16:07:36 +0800 Subject: [PATCH 1/3] =?UTF-8?q?update(REQ-2324)=20-=20=E5=BC=80=E5=90=AF?= =?UTF-8?q?=20Flowable=20=E5=BC=82=E6=AD=A5=E4=BB=BB=E5=8A=A1=E7=9A=84?= =?UTF-8?q?=E5=85=A8=E5=B1=80=E9=94=81=EF=BC=8C=E9=81=BF=E5=85=8D=E5=9B=A0?= =?UTF-8?q?=E4=B8=BA=E7=AB=9E=E4=BA=89=E5=AF=BC=E8=87=B4=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E8=A2=AB=E5=BC=82=E5=B8=B8=E9=94=81=E6=AD=BB=EF=BC=8C=E5=90=8E?= =?UTF-8?q?=E7=BB=AD=E5=86=8D=E6=8E=92=E6=9F=A5=E9=94=81=E6=AD=BB=E7=9A=84?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/axzo/workflow/core/conf/FlowableConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/conf/FlowableConfiguration.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/conf/FlowableConfiguration.java index a1d6c1d84..d0bf6139e 100644 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/conf/FlowableConfiguration.java +++ b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/conf/FlowableConfiguration.java @@ -23,7 +23,6 @@ import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.core.StringRedisTemplate; import java.time.Duration; - import java.util.List; import static org.flowable.common.engine.impl.AbstractEngineConfiguration.DB_SCHEMA_UPDATE_TRUE; @@ -68,6 +67,7 @@ public class FlowableConfiguration { configuration.setDefaultFailedJobWaitTime(30); configuration.setAsyncFailedJobWaitTime(30); configuration.getAsyncExecutorConfiguration().setAsyncJobLockTime(Duration.ofMinutes(5)); + configuration.getAsyncExecutorConfiguration().setGlobalAcquireLockEnabled(true); configuration.setAddDefaultExceptionHandler(false); configuration.setEnableVerboseExecutionTreeLogging(enableVerboseExecutionTreeLogging); configuration.setCustomAsyncRunnableExecutionExceptionHandlers(Lists.newArrayList( From 2da078a40438563bd1eabeacd201e11bef7e2feb Mon Sep 17 00:00:00 2001 From: wangli <274027703@qq.com> Date: Fri, 24 May 2024 16:07:56 +0800 Subject: [PATCH 2/3] =?UTF-8?q?update(REQ-2324)=20-=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E7=9A=84=E7=BA=BF=E7=A8=8B=E6=B1=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/conf/SpringAsyncConfigurer.java | 53 ------------------- 1 file changed, 53 deletions(-) delete mode 100644 workflow-engine-core/src/main/java/cn/axzo/workflow/core/conf/SpringAsyncConfigurer.java diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/conf/SpringAsyncConfigurer.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/conf/SpringAsyncConfigurer.java deleted file mode 100644 index abd77bdd9..000000000 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/conf/SpringAsyncConfigurer.java +++ /dev/null @@ -1,53 +0,0 @@ -package cn.axzo.workflow.core.conf; - -import lombok.extern.slf4j.Slf4j; -import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.scheduling.annotation.AsyncConfigurerSupport; -import org.springframework.scheduling.annotation.EnableAsync; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; - -import java.util.concurrent.Executor; -import java.util.concurrent.ThreadPoolExecutor; - -/** - * 自定义线程配置器 - * - * @author wangli - * @since 2024/4/9 23:10 - */ -@Configuration -@EnableAsync -@Slf4j -public class SpringAsyncConfigurer extends AsyncConfigurerSupport { - - @Bean - public ThreadPoolTaskExecutor asyncExecutor() { - ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); - //核心线程池大小 - executor.setCorePoolSize(5); - //最大线程数 - executor.setMaxPoolSize(10); - //队列容量 - executor.setQueueCapacity(200); - //活跃时间 - executor.setKeepAliveSeconds(60); - //线程名字前缀 - executor.setThreadNamePrefix("ASYNC-EXECUTOR-"); - executor.setWaitForTasksToCompleteOnShutdown(true); - executor.setAwaitTerminationMillis(60); - executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); - return executor; - } - - @Override - public Executor getAsyncExecutor() { - return asyncExecutor(); - } - - @Override - public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { - return (ex, method, params) -> log.error(String.format("执行异步任务出现异常'%s'", method), ex); - } -} From c8d8709e9626f2d205f85e4ddd4b3d94cbd36dda Mon Sep 17 00:00:00 2001 From: wangli <274027703@qq.com> Date: Fri, 24 May 2024 16:08:22 +0800 Subject: [PATCH 3/3] =?UTF-8?q?update(REQ-2324)=20-=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/sql/upgrade_to_1.3.3.sql | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/workflow-engine-core/src/main/resources/sql/upgrade_to_1.3.3.sql b/workflow-engine-core/src/main/resources/sql/upgrade_to_1.3.3.sql index 1d529a302..d65168734 100644 --- a/workflow-engine-core/src/main/resources/sql/upgrade_to_1.3.3.sql +++ b/workflow-engine-core/src/main/resources/sql/upgrade_to_1.3.3.sql @@ -1,19 +1,22 @@ DROP TABLE IF EXISTS `EXT_AX_MQ_LOG`; CREATE TABLE IF NOT EXISTS EXT_AX_MQ_LOG ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', - `unique_id` varchar(50) NOT NULL DEFAULT '' COMMENT '唯一ID', - `message_id` varchar(100) NOT NULL DEFAULT '' COMMENT 'MQ 的 Message ID', - `mq_tag` varchar(50) NOT NULL DEFAULT '' COMMENT 'MQ 的 TAG', - `mq_key` varchar(50) NOT NULL DEFAULT '' COMMENT 'MQ 的 KEY', - `message_body` text COMMENT 'MQ 的 Message Body', - `trace_id` varchar(50) NOT NULL DEFAULT '' COMMENT 'traceId', - `create_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `is_delete` bigint NOT NULL DEFAULT '0' COMMENT '是否删除', + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', + `unique_id` varchar(50) NOT NULL DEFAULT '' COMMENT '唯一ID', + `message_id` varchar(100) NOT NULL DEFAULT '' COMMENT 'MQ 的 Message ID', + `mq_tag` varchar(50) NOT NULL DEFAULT '' COMMENT 'MQ 的 TAG', + `mq_key` varchar(50) NOT NULL DEFAULT '' COMMENT 'MQ 的 KEY', + `message_body` text COMMENT 'MQ 的 Message Body', + `trace_id` varchar(50) NOT NULL DEFAULT '' COMMENT 'traceId', + `create_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `is_delete` bigint NOT NULL DEFAULT '0' COMMENT '是否删除', + `insert_thread_name` varchar(100) NOT NULL DEFAULT '' COMMENT '插入线程名', + `update_thread_name` varchar(100) NOT NULL DEFAULT '' COMMENT '更新线程名', + `delete_thread_name` varchar(100) NOT NULL DEFAULT '' COMMENT '删除线程名', PRIMARY KEY (`id`) ) ENGINE = InnoDB COMMENT 'MQ发送记录表'; -create unique index idx_unique_trace on EXT_AX_MQ_LOG (unique_id, trace_id); +create unique index idx_unique on EXT_AX_MQ_LOG (unique_id);