diff --git a/docs/target-architecture.md b/docs/target-architecture.md index abf4c097..f2d44c91 100644 --- a/docs/target-architecture.md +++ b/docs/target-architecture.md @@ -154,6 +154,8 @@ source of truth for historical queries. ## Data Flow +Default production flow: + ```mermaid flowchart LR vehicle["Vehicles / Platforms"] --> ingest["Protocol apps"] @@ -161,12 +163,14 @@ flowchart LR ingest --> kafka["Kafka
event + raw envelopes"] kafka --> history["vehicle-history-app"] kafka --> analytics["vehicle-analytics-app"] - kafka --> state["vehicle-state-service"] history --> tdengine["TDengine
raw_frames + locations"] analytics --> mysql["MySQL
vehicle_stat_metric"] - state --> redisState["Redis
latest state"] ``` +Optional latest-state flow, enabled only with `-Poptional-latest-state`, consumes +the same Kafka envelopes and rebuilds Redis snapshots outside the default +production deployment. + ## Failure Handling - Protocol apps continue accepting traffic when history, analytics, or Redis diff --git a/modules/apps/vehicle-history-app/src/test/java/com/lingniu/ingest/historyapp/MavenModuleProfileTest.java b/modules/apps/vehicle-history-app/src/test/java/com/lingniu/ingest/historyapp/MavenModuleProfileTest.java index 79d6b715..58652ac8 100644 --- a/modules/apps/vehicle-history-app/src/test/java/com/lingniu/ingest/historyapp/MavenModuleProfileTest.java +++ b/modules/apps/vehicle-history-app/src/test/java/com/lingniu/ingest/historyapp/MavenModuleProfileTest.java @@ -494,6 +494,7 @@ class MavenModuleProfileTest { @Test void productionDocsMatchCompactHistoryAndJt808OnlyAnalyticsSurface() throws Exception { String moduleDataFlow = Files.readString(repositoryRoot().resolve("docs/module-data-flow.html")); + String targetArchitecture = Files.readString(repositoryRoot().resolve("docs/target-architecture.md")); String tdengineVerification = Files.readString(repositoryRoot() .resolve("docs/operations/vehicle-ingest-tdengine-verification.md")); String runbook = Files.readString(repositoryRoot() @@ -511,6 +512,10 @@ class MavenModuleProfileTest { .contains("| `vehicle.event.gb32960.v1` | `gb32960-ingest-app` | `vehicle-history-app` |") .contains("| `vehicle.event.jt808.v1` | `jt808-ingest-app` | `vehicle-history-app`, `vehicle-analytics-app` |") .doesNotContain("| `vehicle.event.gb32960.v1` | `gb32960-ingest-app` | `vehicle-history-app`, `vehicle-analytics-app` |"); + assertThat(targetArchitecture) + .contains("vehicle-state-service is absent from the default Maven reactor") + .doesNotContain("kafka --> state[\"vehicle-state-service\"]") + .doesNotContain("state --> redisState[\"Redis
latest state\"]"); } @Test