refactor: remove archive sink from history runtime
This commit is contained in:
@@ -24,10 +24,6 @@
|
||||
<groupId>com.lingniu.ingest</groupId>
|
||||
<artifactId>sink-mq</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.lingniu.ingest</groupId>
|
||||
<artifactId>sink-archive</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.lingniu.ingest</groupId>
|
||||
<artifactId>protocol-gb32960</artifactId>
|
||||
|
||||
@@ -15,8 +15,6 @@ import com.lingniu.ingest.eventhistory.TelemetryFieldHistoryController;
|
||||
import com.lingniu.ingest.eventhistory.TelemetryEnvelopeRecordMapper;
|
||||
import com.lingniu.ingest.protocol.gb32960.codec.Gb32960MessageDecoder;
|
||||
import com.lingniu.ingest.protocol.gb32960.config.Gb32960AutoConfiguration;
|
||||
import com.lingniu.ingest.sink.archive.config.SinkArchiveAutoConfiguration;
|
||||
import com.lingniu.ingest.sink.archive.config.SinkArchiveProperties;
|
||||
import com.lingniu.ingest.tdenginehistory.config.TdengineHistoryAutoConfiguration;
|
||||
import com.lingniu.ingest.tdenginehistory.TdengineHistoryReader;
|
||||
import com.lingniu.ingest.tdenginehistory.TdengineHistoryWriter;
|
||||
@@ -47,7 +45,6 @@ import java.nio.file.Path;
|
||||
@AutoConfiguration
|
||||
@AutoConfigureAfter({
|
||||
Gb32960AutoConfiguration.class,
|
||||
SinkArchiveAutoConfiguration.class,
|
||||
TdengineHistoryAutoConfiguration.class
|
||||
})
|
||||
@ConditionalOnProperty(prefix = "lingniu.ingest.event-history", name = "enabled", havingValue = "true")
|
||||
@@ -108,10 +105,11 @@ public class EventHistoryAutoConfiguration {
|
||||
public Gb32960DecodedFrameService gb32960DecodedFrameService(ObjectProvider<EventFileStore> store,
|
||||
ObjectProvider<TdengineHistoryReader> reader,
|
||||
Gb32960MessageDecoder decoder,
|
||||
SinkArchiveProperties archiveProperties) {
|
||||
@Value("${lingniu.ingest.event-history.archive-path:${SINK_ARCHIVE_PATH:./archive/}}")
|
||||
String archivePath) {
|
||||
// 优先使用 EventFileStore 索引;TDengine-only 高吞吐运行时可直接从 raw_frames 找 rawUri。
|
||||
return new Gb32960DecodedFrameService(store.getIfAvailable(), reader.getIfAvailable(),
|
||||
decoder, archiveRoot(archiveProperties.getPath()), null);
|
||||
decoder, archiveRoot(archivePath), null);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -16,7 +16,6 @@ import com.lingniu.ingest.eventhistory.TelemetryEnvelopeRecordMapper;
|
||||
import com.lingniu.ingest.protocol.gb32960.codec.Gb32960MessageDecoder;
|
||||
import com.lingniu.ingest.tdenginehistory.TdengineHistoryReader;
|
||||
import com.lingniu.ingest.tdenginehistory.TdengineHistoryWriter;
|
||||
import com.lingniu.ingest.sink.archive.config.SinkArchiveProperties;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
@@ -62,14 +61,13 @@ class EventHistoryAutoConfigurationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void createsGb32960FrameBeansWhenDecoderAndArchivePropertiesExist() {
|
||||
void createsGb32960FrameBeansWhenDecoderExists() {
|
||||
contextRunner
|
||||
.withPropertyValues(
|
||||
"lingniu.ingest.event-history.enabled=true",
|
||||
"lingniu.ingest.event-history.api.specialized-enabled=true",
|
||||
"lingniu.ingest.sink.archive.path=/tmp/lingniu-test-archive")
|
||||
"lingniu.ingest.event-history.archive-path=/tmp/lingniu-test-archive")
|
||||
.withBean(Gb32960MessageDecoder.class, () -> mock(Gb32960MessageDecoder.class))
|
||||
.withBean(SinkArchiveProperties.class, SinkArchiveProperties::new)
|
||||
.run(context -> {
|
||||
assertThat(context).hasSingleBean(Gb32960DecodedFrameService.class);
|
||||
assertThat(context).hasSingleBean(Gb32960FrameController.class);
|
||||
@@ -83,10 +81,9 @@ class EventHistoryAutoConfigurationTest {
|
||||
.withPropertyValues(
|
||||
"lingniu.ingest.event-history.enabled=true",
|
||||
"lingniu.ingest.event-history.api.specialized-enabled=true",
|
||||
"lingniu.ingest.sink.archive.path=/tmp/lingniu-test-archive")
|
||||
"lingniu.ingest.event-history.archive-path=/tmp/lingniu-test-archive")
|
||||
.withBean(Gb32960MessageDecoder.class, () -> mock(Gb32960MessageDecoder.class))
|
||||
.withBean(TdengineHistoryReader.class, () -> mock(TdengineHistoryReader.class))
|
||||
.withBean(SinkArchiveProperties.class, SinkArchiveProperties::new)
|
||||
.run(context -> {
|
||||
assertThat(context).doesNotHaveBean(EventFileStore.class);
|
||||
assertThat(context).hasSingleBean(Gb32960DecodedFrameService.class);
|
||||
|
||||
Reference in New Issue
Block a user