Merge branch 'refs/heads/REQ-2324' into feature/merged_all_req

This commit is contained in:
wangli 2024-05-24 16:08:55 +08:00
commit 1152703f22
3 changed files with 15 additions and 64 deletions

View File

@ -80,6 +80,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(

View File

@ -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);
}
}

View File

@ -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);