docs: clarify kafka-only sink semantics

This commit is contained in:
lingniu
2026-07-01 13:44:23 +08:00
parent 932b386c69
commit a5cb0c9705
2 changed files with 16 additions and 3 deletions

View File

@@ -12,9 +12,9 @@ public class KafkaSinkProperties {
/**
* Kafka Sink 总开关。默认 {@code true}。
* 设为 {@code false} 时 {@link KafkaSinkAutoConfiguration} 完全不装配任何 BeanKafka Producer、
* EnvelopeMapper、TopicRouter、KafkaEventSink 都不会创建ingest-core 的 DisruptorEventBus
* 仍然正常运行但没有外部 sink事件落地到 sink-archive 或 Noop 吞掉)
* 设为 {@code false} 时 {@link KafkaSinkAutoConfiguration} 不装配 Kafka Producer、
* EnvelopeMapper、TopicRouter、KafkaEventSink 等生产端组件。生产接入应用保持默认开启,
* 只有专门的查询/测试运行时才应关闭 Kafka sink
*/
private boolean enabled = true;

View File

@@ -2,6 +2,8 @@ package com.lingniu.ingest.sink.kafka;
import org.junit.jupiter.api.Test;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
import static org.assertj.core.api.Assertions.assertThat;
@@ -23,4 +25,15 @@ class KafkaSinkPropertiesTest {
assertThat(Arrays.stream(KafkaSinkProperties.class.getMethods()).map(method -> method.getName()))
.doesNotContain("getType", "setType");
}
@Test
void sourceCommentsDoNotDescribeKafkaDisabledAsNoopEventDropping() throws Exception {
String source = Files.readString(Path.of(
"src/main/java/com/lingniu/ingest/sink/kafka/KafkaSinkProperties.java"));
assertThat(source)
.doesNotContain("Noop")
.doesNotContain("吞掉")
.doesNotContain("外部 sink");
}
}