From 18aa32a72198dcc3ca8dd8d393a49b59c14093f7 Mon Sep 17 00:00:00 2001 From: lingniu Date: Wed, 1 Jul 2026 07:02:44 +0800 Subject: [PATCH] refactor: keep kafka clients behind sink mq --- .../services/event-history-service/pom.xml | 4 ---- .../config/EventHistoryPomBoundaryTest.java | 24 +++++++++++++++++-- modules/services/vehicle-stat-service/pom.xml | 4 ---- .../services/vehicle-state-service/pom.xml | 4 ---- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/modules/services/event-history-service/pom.xml b/modules/services/event-history-service/pom.xml index b1483ca3..7932ff45 100644 --- a/modules/services/event-history-service/pom.xml +++ b/modules/services/event-history-service/pom.xml @@ -28,10 +28,6 @@ com.lingniu.ingest protocol-gb32960 - - org.apache.kafka - kafka-clients - org.springframework.boot spring-boot-starter-web diff --git a/modules/services/event-history-service/src/test/java/com/lingniu/ingest/eventhistory/config/EventHistoryPomBoundaryTest.java b/modules/services/event-history-service/src/test/java/com/lingniu/ingest/eventhistory/config/EventHistoryPomBoundaryTest.java index 96e79384..095d2248 100644 --- a/modules/services/event-history-service/src/test/java/com/lingniu/ingest/eventhistory/config/EventHistoryPomBoundaryTest.java +++ b/modules/services/event-history-service/src/test/java/com/lingniu/ingest/eventhistory/config/EventHistoryPomBoundaryTest.java @@ -21,11 +21,31 @@ class EventHistoryPomBoundaryTest { .doesNotContain("com.taosdata.jdbc:taos-jdbcdriver"); } + @Test + void kafkaClientsIsOwnedBySinkMqModule() throws Exception { + for (Path pom : servicePoms()) { + assertThat(directDependencies(readPom(pom))) + .as(pom.toString()) + .doesNotContain("org.apache.kafka:kafka-clients"); + } + } + private static Document modulePom() throws Exception { + return readPom(repositoryRoot().resolve("modules/services/event-history-service/pom.xml")); + } + + private static Document readPom(Path pom) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); - return factory.newDocumentBuilder().parse(Files.newInputStream(repositoryRoot() - .resolve("modules/services/event-history-service/pom.xml"))); + return factory.newDocumentBuilder().parse(Files.newInputStream(pom)); + } + + private static List servicePoms() { + Path services = repositoryRoot().resolve("modules/services"); + return List.of( + services.resolve("event-history-service/pom.xml"), + services.resolve("vehicle-state-service/pom.xml"), + services.resolve("vehicle-stat-service/pom.xml")); } private static List directDependencies(Document pom) { diff --git a/modules/services/vehicle-stat-service/pom.xml b/modules/services/vehicle-stat-service/pom.xml index 0209f0ba..28c1268f 100644 --- a/modules/services/vehicle-stat-service/pom.xml +++ b/modules/services/vehicle-stat-service/pom.xml @@ -16,10 +16,6 @@ com.lingniu.ingest sink-mq - - org.apache.kafka - kafka-clients - org.springframework.boot spring-boot-autoconfigure diff --git a/modules/services/vehicle-state-service/pom.xml b/modules/services/vehicle-state-service/pom.xml index c3279287..0413b743 100644 --- a/modules/services/vehicle-state-service/pom.xml +++ b/modules/services/vehicle-state-service/pom.xml @@ -16,10 +16,6 @@ com.lingniu.ingest sink-mq - - org.apache.kafka - kafka-clients - org.springframework.boot spring-boot-starter-data-redis