From 78fa28ae243bd12bc4793ff200a8d62245787836 Mon Sep 17 00:00:00 2001 From: daxpay Date: Tue, 11 Aug 2026 23:04:45 +0800 Subject: [PATCH] =?UTF-8?q?refactor(artemis):=20=E7=A7=BB=E9=99=A4=20embed?= =?UTF-8?q?ded=20=E6=A8=A1=E5=BC=8F=EF=BC=8C=E6=81=A2=E5=A4=8D=20netty=204?= =?UTF-8?q?.2=20=E4=BF=AE=E5=A4=8D=20Linux=20Lettuce=20=E5=B4=A9=E6=BA=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根 pom 删 netty.version=4.1.135 覆盖,恢复 Boot 4.1 默认 netty 4.2.15; common-artemis 删 artemis-jms-server 依赖(fat jar 不再含 EmbeddedActiveMQ, Spring Boot @ConditionalOnClass 自动跳过 embedded 装配); application-dev/prod.yml 删 spring.artemis.embedded 段,mode 固定 native。 根因:netty 4.1 降级曾为修 JDK25+Artemis embedded 的 CleanerJava25 崩溃, 但 Lettuce 7.5.2 针对 netty 4.2 编译,Linux epoll 路径引用 MultiThreadIoEventLoopGroup(4.2 新基类)致 NoClassDefFoundError; 移除 embedded 消除 CleanerJava25 触发点后 netty 恢复 4.2,Lettuce 正常。 --- .../common-artemis/pom.xml | 7 ------- .../src/main/resources/application-dev.yml | 19 +++++++------------ .../src/main/resources/application-prod.yml | 14 +++----------- pom.xml | 16 +++++++--------- 4 files changed, 17 insertions(+), 39 deletions(-) diff --git a/daxpay-platform/daxpay-platform-common/common-artemis/pom.xml b/daxpay-platform/daxpay-platform-common/common-artemis/pom.xml index a9f74525b..4fca02419 100644 --- a/daxpay-platform/daxpay-platform-common/common-artemis/pom.xml +++ b/daxpay-platform/daxpay-platform-common/common-artemis/pom.xml @@ -24,13 +24,6 @@ org.messaginghub pooled-jms - - - org.apache.activemq - artemis-jms-server - cn.daxpay.open diff --git a/daxpay-start/src/main/resources/application-dev.yml b/daxpay-start/src/main/resources/application-dev.yml index cce2fdee1..ab89030ae 100644 --- a/daxpay-start/src/main/resources/application-dev.yml +++ b/daxpay-start/src/main/resources/application-dev.yml @@ -34,23 +34,18 @@ spring: lettuce: pool: max-wait: 1000ms - # Artemis 消息队列(双模式:native=外置容器 / embedded=内嵌 JVM) - # 本地开发默认 embedded:无需启动独立 artemis 容器,broker 内嵌后端 JVM - # 如需连外部 broker(联调 docker artemis):设环境变量 - # ARTEMIS_MODE=native + ARTEMIS_BROKER_URL/USER/PASSWORD + # Artemis 消息队列(native 模式:连接外部独立 broker 容器,不再支持内嵌模式) artemis: - mode: ${ARTEMIS_MODE:embedded} - broker-url: ${ARTEMIS_BROKER_URL:tcp://192.168.1.229:61616} - user: ${ARTEMIS_USER:admin} - password: ${ARTEMIS_PASSWORD:admin} + mode: native + # Broker 连接地址 + broker-url: tcp://192.168.1.229:61616 + # broker 账号(与容器启动环境变量一致) + user: admin + password: admin pool: enabled: true max-connections: 10 idle-timeout: 30s - embedded: - enabled: true - persistent: true - data-directory: ${ARTEMIS_DATA_DIR:./data/artemis} jms: # 会话缓存,提升发送性能 cache: diff --git a/daxpay-start/src/main/resources/application-prod.yml b/daxpay-start/src/main/resources/application-prod.yml index c8c4c7e97..107283037 100644 --- a/daxpay-start/src/main/resources/application-prod.yml +++ b/daxpay-start/src/main/resources/application-prod.yml @@ -40,25 +40,17 @@ spring: lettuce: pool: max-wait: 1000ms - # Artemis 消息队列(双模式:native=外置容器 / embedded=内嵌 JVM) - # 切换:环境变量 ARTEMIS_MODE=native|embedded(默认 native),无需改代码、不重打包 - # - native:连接独立 artemis 容器(标准部署),需 ARTEMIS_USER/PASSWORD(installer 注入) - # - embedded:broker 内嵌后端 JVM(内存紧张场景省独立 JVM),无需凭证,journal 落 ARTEMIS_DATA_DIR + # Artemis 消息队列(native 模式:连接外部独立 broker 容器,不再支持内嵌模式) + # 凭证与地址由 installer 注入(ARTEMIS_BROKER_URL / ARTEMIS_USER / ARTEMIS_PASSWORD) artemis: - mode: ${ARTEMIS_MODE:native} + mode: native broker-url: ${ARTEMIS_BROKER_URL:tcp://artemis:61616} - # 凭证空串兜底:embedded 模式不传也不报错;native 模式由 installer 注入真实值 user: ${ARTEMIS_USER:} password: ${ARTEMIS_PASSWORD:} pool: enabled: true max-connections: 20 idle-timeout: 30s - embedded: - enabled: true - # 持久化:支付超时 / 通知消息重启不丢(journal 落盘) - persistent: true - data-directory: ${ARTEMIS_DATA_DIR:./data/artemis} jms: cache: enabled: true diff --git a/pom.xml b/pom.xml index 2d3e80457..2ab8cfa33 100644 --- a/pom.xml +++ b/pom.xml @@ -57,15 +57,13 @@ 3.3.7 4.8.4.B 0.24.0 - - 4.1.135.Final +