刘光辉
昨天 bb638871a7fb692d80f1b7a758f991dc0879002c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.jnpf</groupId>
        <artifactId>jnpf-java-cloud</artifactId>
        <version>6.1.0-RELEASE</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>
 
    <artifactId>jnpf-cloud-base</artifactId>
 
    <dependencies>
        <dependency>
            <groupId>com.jnpf</groupId>
            <artifactId>jnpf-common-core</artifactId>
            <version>${project.version}</version>
        </dependency>
 
        <!-- jnpf-common-mq 保留:它提供 ProjectEventSender 的 MQ 实现。
             (2026-08-11 订正:原注释写"audit-sdk 的 AuditEventPublisher 构造参数还需要 StreamBridge",
             该理由已失效——audit-sdk 于当日移除了对 StreamBridge 的引用。真正的理由见下方
             spring-cloud-stream 那条:jnpf-common-mq 自己的类就引用 StreamBridge。) -->
        <dependency>
            <groupId>com.jnpf</groupId>
            <artifactId>jnpf-common-mq</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>jnpf-common-database</artifactId>
                    <groupId>com.jnpf</groupId>
                </exclusion>
                <!-- 2026-08-10:事件总线切 Redis(config/shared/system-config.yaml 的
                     event.event-publish-type: redis),RocketMQ binder 不再需要。
 
                     排掉它有两层收益:
                       ① fat jar 瘦身——rocketmq-rocksdb 单个就 30 MB,加上 client/remoting/
                          proto/acl/logback 等约 32 MB,×14 个服务镜像;
                       ② (2026-08-11 失效)原写"让 AuditEventPublisher 的降级快速失败"——
                          审计投递已不走 streamBridge,降级链改为 Feign → spool 两级。
                          收益 ① 的 fat jar 瘦身仍然成立,本 exclusion 保留。
 
                     ⚠️ 前置条件:config/shared/mq.yaml 必须有
                     `spring.cloud.stream.function.autodetect: false`。否则 SCS 会自动发现
                     jnpf-common-mq 里那个**未受 event-publish-type 门控**的 ssoEventReceiver
                     bean 并为它建绑定,而此时 classpath 上已无任何 binder →
                     「有绑定却无 binder」启动即失败。两者是一对,不能只改一边。
 
                     三个 binder 在 jnpf-common-mq 的 pom 里本就是 <optional>true</optional>,
                     这是 JNPF 官方留的可插拔点;要换回 RocketMQ 或改用 RabbitMQ/Kafka,
                     删掉本 exclusion 或换成对应 starter 即可,业务代码不动。 -->
                <exclusion>
                    <groupId>com.alibaba.cloud</groupId>
                    <artifactId>spring-cloud-starter-stream-rocketmq</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
 
        <!-- 🔴 必须与上面那条 exclusion 配对,不能只写一半。
             spring-cloud-stream **核心** 此前是经 rocketmq starter 传递进来的;排掉 starter
             会把核心一并带走,于是 StreamBridge 这个类就没了。后果不是「MQ 不可用」而是
             **启动直接崩**(NoClassDefFoundError)。
 
             2026-08-11 订正「谁需要它」:原注释归因于 jnpf-audit-sdk 的 AuditEventPublisher
             把 StreamBridge 写在构造参数上——**该理由已随 audit 降级链砍到两级而失效**。
             但依赖仍必须保留,真正的使用者是 jnpf-common-mq 这个二进制 jar 自己:
             javap 实查其 ProjectEventMQSender 与 MqAutoConfiguration$MqExistsdConfiguration
             两个类的常量池都引用 StreamBridge。当前 event-publish-type=redis 下
             MqExistsdConfiguration 不装配、暂不触发类加载,但改回 mq 即崩,
             且报错会是 NoClassDefFoundError 而非「没配 binder」,极难排查。
             显式补核心 = 有 StreamBridge、无任何 binder。 -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-stream</artifactId>
        </dependency>
 
        <!-- 补丁 #8:显式声明以自档:静态发现依赖 spring-cloud-loadbalancer
             (根 pom 全局 dependencies 本就带这条,60 个 FeignClient 与网关路由并不靠它才能用;
             此处显式化只为防根 pom 精简依赖时被静默丢掉) -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-loadbalancer</artifactId>
        </dependency>
 
 
    </dependencies>
 
</project>