refactor: keep kafka clients behind sink mq

This commit is contained in:
lingniu
2026-07-01 07:02:44 +08:00
parent 40dea58278
commit 18aa32a721
4 changed files with 22 additions and 14 deletions

View File

@@ -28,10 +28,6 @@
<groupId>com.lingniu.ingest</groupId> <groupId>com.lingniu.ingest</groupId>
<artifactId>protocol-gb32960</artifactId> <artifactId>protocol-gb32960</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>

View File

@@ -21,11 +21,31 @@ class EventHistoryPomBoundaryTest {
.doesNotContain("com.taosdata.jdbc:taos-jdbcdriver"); .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 { 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(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
return factory.newDocumentBuilder().parse(Files.newInputStream(repositoryRoot() return factory.newDocumentBuilder().parse(Files.newInputStream(pom));
.resolve("modules/services/event-history-service/pom.xml"))); }
private static List<Path> 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<String> directDependencies(Document pom) { private static List<String> directDependencies(Document pom) {

View File

@@ -16,10 +16,6 @@
<groupId>com.lingniu.ingest</groupId> <groupId>com.lingniu.ingest</groupId>
<artifactId>sink-mq</artifactId> <artifactId>sink-mq</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId> <artifactId>spring-boot-autoconfigure</artifactId>

View File

@@ -16,10 +16,6 @@
<groupId>com.lingniu.ingest</groupId> <groupId>com.lingniu.ingest</groupId>
<artifactId>sink-mq</artifactId> <artifactId>sink-mq</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId> <artifactId>spring-boot-starter-data-redis</artifactId>