diff --git a/docs/target-architecture.md b/docs/target-architecture.md index 7f455b8f..de7987db 100644 --- a/docs/target-architecture.md +++ b/docs/target-architecture.md @@ -43,7 +43,8 @@ is explicitly deployed. - Redis is not the long-term historical store. - `event-file-store` Parquet/DuckDB is not the default history store. - `telemetry_fields` parsing is not handled by this project when a separate - field parsing service owns that job. + field parsing service owns that job; the `telemetry_fields` query API is + also disabled by default unless `TDENGINE_TELEMETRY_FIELDS_ENABLED=true`. ## Runtime Responsibilities diff --git a/modules/apps/vehicle-history-app/src/test/java/com/lingniu/ingest/historyapp/VehicleHistoryAppCompositionTest.java b/modules/apps/vehicle-history-app/src/test/java/com/lingniu/ingest/historyapp/VehicleHistoryAppCompositionTest.java index 2324b2c6..6fed29bc 100644 --- a/modules/apps/vehicle-history-app/src/test/java/com/lingniu/ingest/historyapp/VehicleHistoryAppCompositionTest.java +++ b/modules/apps/vehicle-history-app/src/test/java/com/lingniu/ingest/historyapp/VehicleHistoryAppCompositionTest.java @@ -121,7 +121,7 @@ class VehicleHistoryAppCompositionTest { assertThat(context).hasSingleBean(Gb32960DecodedFrameService.class); assertThat(context).hasSingleBean(LocationHistoryController.class); assertThat(context).hasSingleBean(RawFrameHistoryController.class); - assertThat(context).hasSingleBean(TelemetryFieldHistoryController.class); + assertThat(context).doesNotHaveBean(TelemetryFieldHistoryController.class); assertThat(context).doesNotHaveBean(Gb32960FrameController.class); assertThat(context).doesNotHaveBean(Jt808LocationHistoryController.class); assertThat(context).doesNotHaveBean(Gb32960NettyServer.class); diff --git a/modules/services/event-history-service/src/main/java/com/lingniu/ingest/eventhistory/config/EventHistoryAutoConfiguration.java b/modules/services/event-history-service/src/main/java/com/lingniu/ingest/eventhistory/config/EventHistoryAutoConfiguration.java index 882d6607..e1f444ef 100644 --- a/modules/services/event-history-service/src/main/java/com/lingniu/ingest/eventhistory/config/EventHistoryAutoConfiguration.java +++ b/modules/services/event-history-service/src/main/java/com/lingniu/ingest/eventhistory/config/EventHistoryAutoConfiguration.java @@ -154,6 +154,7 @@ public class EventHistoryAutoConfiguration { @Bean @ConditionalOnBean(TdengineHistoryReader.class) + @ConditionalOnProperty(prefix = "lingniu.ingest.tdengine-history", name = "telemetry-fields-enabled", havingValue = "true") @ConditionalOnMissingBean public TelemetryFieldHistoryController telemetryFieldHistoryController(TdengineHistoryReader reader) { return new TelemetryFieldHistoryController(reader); diff --git a/modules/services/event-history-service/src/test/java/com/lingniu/ingest/eventhistory/config/EventHistoryAutoConfigurationTest.java b/modules/services/event-history-service/src/test/java/com/lingniu/ingest/eventhistory/config/EventHistoryAutoConfigurationTest.java index e213c791..c855b934 100644 --- a/modules/services/event-history-service/src/test/java/com/lingniu/ingest/eventhistory/config/EventHistoryAutoConfigurationTest.java +++ b/modules/services/event-history-service/src/test/java/com/lingniu/ingest/eventhistory/config/EventHistoryAutoConfigurationTest.java @@ -120,14 +120,14 @@ class EventHistoryAutoConfigurationTest { } @Test - void createsGenericLocationAndTelemetryControllersWhenTdengineReaderExists() { + void createsGenericLocationAndRawControllersWithoutTelemetryFieldsByDefault() { contextRunner .withPropertyValues("lingniu.ingest.event-history.enabled=true") .withBean(TdengineHistoryReader.class, () -> mock(TdengineHistoryReader.class)) .run(context -> { assertThat(context).hasSingleBean(LocationHistoryController.class); assertThat(context).hasSingleBean(RawFrameHistoryController.class); - assertThat(context).hasSingleBean(TelemetryFieldHistoryController.class); + assertThat(context).doesNotHaveBean(TelemetryFieldHistoryController.class); assertThat(context).doesNotHaveBean(Jt808LocationHistoryController.class); assertThat(context).doesNotHaveBean(Jt808RawFrameHistoryController.class); }); @@ -152,9 +152,11 @@ class EventHistoryAutoConfigurationTest { } @Test - void createsTelemetryFieldHistoryControllerWhenTdengineReaderExists() { + void createsTelemetryFieldHistoryControllerWhenTelemetryFieldsAreEnabled() { contextRunner - .withPropertyValues("lingniu.ingest.event-history.enabled=true") + .withPropertyValues( + "lingniu.ingest.event-history.enabled=true", + "lingniu.ingest.tdengine-history.telemetry-fields-enabled=true") .withBean(TdengineHistoryReader.class, () -> mock(TdengineHistoryReader.class)) .run(context -> assertThat(context).hasSingleBean(TelemetryFieldHistoryController.class)); }