feat: add jt808 ingest app
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -10,6 +10,6 @@ ENV JAVA_OPTS=""
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY modules/apps/${APP_NAME}/target/${APP_NAME}.jar /app/app.jar
|
COPY modules/apps/${APP_NAME}/target/${APP_NAME}.jar /app/app.jar
|
||||||
|
|
||||||
EXPOSE 20100 20200 20300 32960
|
EXPOSE 20100 20200 20300 20400 32960 10808
|
||||||
|
|
||||||
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /app/app.jar"]
|
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /app/app.jar"]
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ lingniu-vehicle-ingest/
|
|||||||
│ └── apps/
|
│ └── apps/
|
||||||
│ ├── command-gateway/ HTTP → 设备下行命令(808 位置/参数/属性/控制/区域删除/报警确认 + 1078 音视频控制)
|
│ ├── command-gateway/ HTTP → 设备下行命令(808 位置/参数/属性/控制/区域删除/报警确认 + 1078 音视频控制)
|
||||||
│ ├── gb32960-ingest-app/ GB32960 TCP 接入 + Kafka 投递
|
│ ├── gb32960-ingest-app/ GB32960 TCP 接入 + Kafka 投递
|
||||||
|
│ ├── jt808-ingest-app/ JT808 TCP 接入 + Kafka 投递
|
||||||
│ ├── vehicle-history-app/ 历史查询 + 原始归档索引消费
|
│ ├── vehicle-history-app/ 历史查询 + 原始归档索引消费
|
||||||
│ └── vehicle-analytics-app/ 车辆状态/日统计消费
|
│ └── vehicle-analytics-app/ 车辆状态/日统计消费
|
||||||
├── docs/ 架构文档、模块图、实施计划
|
├── docs/ 架构文档、模块图、实施计划
|
||||||
@@ -71,6 +72,7 @@ lingniu-vehicle-ingest/
|
|||||||
mvn -v
|
mvn -v
|
||||||
mvn clean install -DskipTests
|
mvn clean install -DskipTests
|
||||||
mvn -pl :gb32960-ingest-app -am spring-boot:run
|
mvn -pl :gb32960-ingest-app -am spring-boot:run
|
||||||
|
mvn -pl :jt808-ingest-app -am spring-boot:run
|
||||||
```
|
```
|
||||||
|
|
||||||
## 迁移说明
|
## 迁移说明
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ x-common-env: &common-env
|
|||||||
KAFKA_TOPIC_GB32960_EVENT: ${KAFKA_TOPIC_GB32960_EVENT:-vehicle.event.gb32960.v1}
|
KAFKA_TOPIC_GB32960_EVENT: ${KAFKA_TOPIC_GB32960_EVENT:-vehicle.event.gb32960.v1}
|
||||||
KAFKA_TOPIC_GB32960_RAW: ${KAFKA_TOPIC_GB32960_RAW:-vehicle.raw.gb32960.v1}
|
KAFKA_TOPIC_GB32960_RAW: ${KAFKA_TOPIC_GB32960_RAW:-vehicle.raw.gb32960.v1}
|
||||||
KAFKA_TOPIC_GB32960_DLQ: ${KAFKA_TOPIC_GB32960_DLQ:-vehicle.dlq.gb32960.v1}
|
KAFKA_TOPIC_GB32960_DLQ: ${KAFKA_TOPIC_GB32960_DLQ:-vehicle.dlq.gb32960.v1}
|
||||||
|
KAFKA_TOPIC_JT808_EVENT: ${KAFKA_TOPIC_JT808_EVENT:-vehicle.event.jt808.v1}
|
||||||
|
KAFKA_TOPIC_JT808_RAW: ${KAFKA_TOPIC_JT808_RAW:-vehicle.raw.jt808.v1}
|
||||||
|
KAFKA_TOPIC_JT808_DLQ: ${KAFKA_TOPIC_JT808_DLQ:-vehicle.dlq.jt808.v1}
|
||||||
|
|
||||||
services:
|
services:
|
||||||
gb32960-ingest-app:
|
gb32960-ingest-app:
|
||||||
@@ -45,12 +48,32 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- vehicle-ingest
|
- vehicle-ingest
|
||||||
|
|
||||||
|
jt808-ingest-app:
|
||||||
|
image: crpi-85r4m0ackrm3qpje-vpc.cn-shanghai.personal.cr.aliyuncs.com/oneos/jt808-ingest-app:${LINGNIU_IMAGE_VERSION:?set LINGNIU_IMAGE_VERSION}
|
||||||
|
container_name: jt808-ingest-app
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
<<: *common-env
|
||||||
|
HTTP_PORT: 20400
|
||||||
|
JT808_PORT: 10808
|
||||||
|
KAFKA_CONSUMER_ENABLED: "false"
|
||||||
|
KAFKA_NODE_ID: ${KAFKA_NODE_ID_JT808:-jt808-ingest-portainer}
|
||||||
|
VEHICLE_IDENTITY_FILE: /data/vehicle-identity.jsonl
|
||||||
|
ports:
|
||||||
|
- "${JT808_HTTP_PORT:-20400}:20400"
|
||||||
|
- "${JT808_TCP_PORT:-10808}:10808"
|
||||||
|
volumes:
|
||||||
|
- jt808-ingest-data:/data
|
||||||
|
networks:
|
||||||
|
- vehicle-ingest
|
||||||
|
|
||||||
vehicle-history-app:
|
vehicle-history-app:
|
||||||
image: crpi-85r4m0ackrm3qpje-vpc.cn-shanghai.personal.cr.aliyuncs.com/oneos/vehicle-history-app:${LINGNIU_IMAGE_VERSION:?set LINGNIU_IMAGE_VERSION}
|
image: crpi-85r4m0ackrm3qpje-vpc.cn-shanghai.personal.cr.aliyuncs.com/oneos/vehicle-history-app:${LINGNIU_IMAGE_VERSION:?set LINGNIU_IMAGE_VERSION}
|
||||||
container_name: vehicle-history-app
|
container_name: vehicle-history-app
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
- gb32960-ingest-app
|
- gb32960-ingest-app
|
||||||
|
- jt808-ingest-app
|
||||||
environment:
|
environment:
|
||||||
<<: *common-env
|
<<: *common-env
|
||||||
HTTP_PORT: 20200
|
HTTP_PORT: 20200
|
||||||
@@ -75,6 +98,7 @@ services:
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
- gb32960-ingest-app
|
- gb32960-ingest-app
|
||||||
|
- jt808-ingest-app
|
||||||
environment:
|
environment:
|
||||||
<<: *common-env
|
<<: *common-env
|
||||||
HTTP_PORT: 20300
|
HTTP_PORT: 20300
|
||||||
@@ -98,6 +122,7 @@ networks:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
gb32960-ingest-data:
|
gb32960-ingest-data:
|
||||||
|
jt808-ingest-data:
|
||||||
vehicle-history-archive:
|
vehicle-history-archive:
|
||||||
vehicle-history-event-store:
|
vehicle-history-event-store:
|
||||||
vehicle-analytics-stat:
|
vehicle-analytics-stat:
|
||||||
|
|||||||
@@ -41,6 +41,10 @@
|
|||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
|||||||
@@ -21,6 +21,12 @@ spring:
|
|||||||
server:
|
server:
|
||||||
port: ${HTTP_PORT:20100}
|
port: ${HTTP_PORT:20100}
|
||||||
|
|
||||||
|
springdoc:
|
||||||
|
swagger-ui:
|
||||||
|
path: /swagger-ui.html
|
||||||
|
api-docs:
|
||||||
|
path: /v3/api-docs
|
||||||
|
|
||||||
lingniu:
|
lingniu:
|
||||||
ingest:
|
ingest:
|
||||||
gb32960:
|
gb32960:
|
||||||
|
|||||||
79
modules/apps/jt808-ingest-app/pom.xml
Normal file
79
modules/apps/jt808-ingest-app/pom.xml
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.lingniu.ingest</groupId>
|
||||||
|
<artifactId>lingniu-vehicle-ingest</artifactId>
|
||||||
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>jt808-ingest-app</artifactId>
|
||||||
|
<name>jt808-ingest-app</name>
|
||||||
|
<description>JT808 protocol ingress runtime: TCP decode, identity mapping, Kafka production, and downlink session routing.</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.lingniu.ingest</groupId>
|
||||||
|
<artifactId>ingest-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.lingniu.ingest</groupId>
|
||||||
|
<artifactId>session-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.lingniu.ingest</groupId>
|
||||||
|
<artifactId>observability</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.lingniu.ingest</groupId>
|
||||||
|
<artifactId>vehicle-identity</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.lingniu.ingest</groupId>
|
||||||
|
<artifactId>protocol-jt808</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.lingniu.ingest</groupId>
|
||||||
|
<artifactId>sink-mq</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>jt808-ingest-app</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<jvmArguments>--sun-misc-unsafe-memory-access=allow</jvmArguments>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
<goal>build-info</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.lingniu.ingest.jt808app;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication(scanBasePackages = "com.lingniu.ingest")
|
||||||
|
public class Jt808IngestApplication {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(Jt808IngestApplication.class);
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
try {
|
||||||
|
SpringApplication.run(Jt808IngestApplication.class, args);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
log.error("JT808 ingest application failed to start, forcing JVM exit", t);
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: jt808-ingest-app
|
||||||
|
config:
|
||||||
|
import:
|
||||||
|
- optional:nacos:${spring.application.name}.${NACOS_CONFIG_FILE_EXTENSION:yml}?group=${NACOS_GROUP:DEFAULT_GROUP}&refreshEnabled=${NACOS_REFRESH_ENABLED:true}
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
config:
|
||||||
|
enabled: ${NACOS_CONFIG_ENABLED:true}
|
||||||
|
server-addr: ${NACOS_SERVER_ADDR:127.0.0.1:8848}
|
||||||
|
namespace: ${NACOS_NAMESPACE:}
|
||||||
|
group: ${NACOS_GROUP:DEFAULT_GROUP}
|
||||||
|
file-extension: ${NACOS_CONFIG_FILE_EXTENSION:yml}
|
||||||
|
username: ${NACOS_USERNAME:}
|
||||||
|
password: ${NACOS_PASSWORD:}
|
||||||
|
threads:
|
||||||
|
virtual:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
server:
|
||||||
|
port: ${HTTP_PORT:20400}
|
||||||
|
|
||||||
|
springdoc:
|
||||||
|
swagger-ui:
|
||||||
|
path: /swagger-ui.html
|
||||||
|
api-docs:
|
||||||
|
path: /v3/api-docs
|
||||||
|
|
||||||
|
lingniu:
|
||||||
|
ingest:
|
||||||
|
jt808:
|
||||||
|
enabled: true
|
||||||
|
port: ${JT808_PORT:10808}
|
||||||
|
worker-threads: ${JT808_WORKER_THREADS:0}
|
||||||
|
pipeline:
|
||||||
|
disruptor:
|
||||||
|
ring-buffer-size: ${PIPELINE_RING_BUFFER_SIZE:131072}
|
||||||
|
wait-strategy: ${PIPELINE_WAIT_STRATEGY:yielding}
|
||||||
|
producer-type: multi
|
||||||
|
dedup:
|
||||||
|
enabled: true
|
||||||
|
cache-size: 200000
|
||||||
|
ttl-seconds: 600
|
||||||
|
rate-limit:
|
||||||
|
per-vin-qps: 50
|
||||||
|
session:
|
||||||
|
store: ${SESSION_STORE:memory}
|
||||||
|
ttl: ${SESSION_TTL:30m}
|
||||||
|
identity:
|
||||||
|
store: ${VEHICLE_IDENTITY_STORE:file}
|
||||||
|
file:
|
||||||
|
path: ${VEHICLE_IDENTITY_FILE:./data/vehicle-identity.jsonl}
|
||||||
|
sink:
|
||||||
|
mq:
|
||||||
|
enabled: ${KAFKA_ENABLED:true}
|
||||||
|
type: kafka
|
||||||
|
bootstrap-servers: ${KAFKA_BROKERS:114.55.58.251:9092}
|
||||||
|
compression-type: zstd
|
||||||
|
linger-ms: 20
|
||||||
|
batch-size: 65536
|
||||||
|
acks: all
|
||||||
|
enable-idempotence: true
|
||||||
|
node-id: ${KAFKA_NODE_ID:jt808-ingest-local}
|
||||||
|
topics:
|
||||||
|
realtime: ${KAFKA_TOPIC_JT808_EVENT:vehicle.event.jt808.v1}
|
||||||
|
location: ${KAFKA_TOPIC_JT808_EVENT:vehicle.event.jt808.v1}
|
||||||
|
alarm: ${KAFKA_TOPIC_JT808_EVENT:vehicle.event.jt808.v1}
|
||||||
|
session: ${KAFKA_TOPIC_JT808_EVENT:vehicle.event.jt808.v1}
|
||||||
|
media-meta: ${KAFKA_TOPIC_MEDIA_META:vehicle.media.meta.v1}
|
||||||
|
raw-archive: ${KAFKA_TOPIC_JT808_RAW:vehicle.raw.jt808.v1}
|
||||||
|
dlq: ${KAFKA_TOPIC_JT808_DLQ:vehicle.dlq.jt808.v1}
|
||||||
|
consumer:
|
||||||
|
enabled: false
|
||||||
|
event-file-store:
|
||||||
|
enabled: false
|
||||||
|
event-history:
|
||||||
|
enabled: false
|
||||||
|
vehicle-state:
|
||||||
|
enabled: false
|
||||||
|
vehicle-stat:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
management:
|
||||||
|
endpoints:
|
||||||
|
web:
|
||||||
|
exposure:
|
||||||
|
include: health,info,metrics,prometheus,env
|
||||||
|
health:
|
||||||
|
redis:
|
||||||
|
enabled: ${MANAGEMENT_HEALTH_REDIS_ENABLED:false}
|
||||||
|
metrics:
|
||||||
|
tags:
|
||||||
|
application: jt808-ingest-app
|
||||||
|
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
root: INFO
|
||||||
|
com.lingniu.ingest: INFO
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package com.lingniu.ingest.jt808app;
|
||||||
|
|
||||||
|
import com.lingniu.ingest.core.config.IngestCoreAutoConfiguration;
|
||||||
|
import com.lingniu.ingest.identity.config.VehicleIdentityAutoConfiguration;
|
||||||
|
import com.lingniu.ingest.protocol.jt808.codec.Jt808MessageDecoder;
|
||||||
|
import com.lingniu.ingest.protocol.jt808.config.Jt808AutoConfiguration;
|
||||||
|
import com.lingniu.ingest.protocol.jt808.inbound.Jt808NettyServer;
|
||||||
|
import com.lingniu.ingest.session.config.SessionCoreAutoConfiguration;
|
||||||
|
import com.lingniu.ingest.sink.mq.KafkaEnvelopeDeadLetterSink;
|
||||||
|
import com.lingniu.ingest.sink.mq.KafkaEventSink;
|
||||||
|
import com.lingniu.ingest.sink.mq.SinkMqAutoConfiguration;
|
||||||
|
import org.apache.kafka.clients.producer.KafkaProducer;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||||
|
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.util.ClassUtils;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
|
class Jt808IngestAppCompositionTest {
|
||||||
|
|
||||||
|
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||||
|
.withConfiguration(AutoConfigurations.of(
|
||||||
|
IngestCoreAutoConfiguration.class,
|
||||||
|
SessionCoreAutoConfiguration.class,
|
||||||
|
VehicleIdentityAutoConfiguration.class,
|
||||||
|
SinkMqAutoConfiguration.class,
|
||||||
|
Jt808AutoConfiguration.class))
|
||||||
|
.withAllowBeanDefinitionOverriding(true)
|
||||||
|
.withBean("kafkaProducer", KafkaProducer.class, Jt808IngestAppCompositionTest::kafkaProducer)
|
||||||
|
.withPropertyValues(
|
||||||
|
"lingniu.ingest.jt808.enabled=true",
|
||||||
|
"lingniu.ingest.jt808.port=0",
|
||||||
|
"lingniu.ingest.session.store=memory",
|
||||||
|
"lingniu.ingest.sink.mq.enabled=true",
|
||||||
|
"lingniu.ingest.sink.mq.type=kafka",
|
||||||
|
"lingniu.ingest.sink.mq.bootstrap-servers=localhost:9092",
|
||||||
|
"lingniu.ingest.sink.mq.consumer.enabled=false",
|
||||||
|
"lingniu.ingest.event-file-store.enabled=false",
|
||||||
|
"lingniu.ingest.event-history.enabled=false",
|
||||||
|
"lingniu.ingest.vehicle-state.enabled=false",
|
||||||
|
"lingniu.ingest.vehicle-stat.enabled=false");
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void createsJt808ListenerWithoutHistoryStorageBoundaries() {
|
||||||
|
contextRunner.run(context -> {
|
||||||
|
assertThat(context).hasSingleBean(Jt808MessageDecoder.class);
|
||||||
|
assertThat(context).hasSingleBean(Jt808NettyServer.class);
|
||||||
|
assertThat(context).hasSingleBean(KafkaEventSink.class);
|
||||||
|
assertThat(context).hasSingleBean(KafkaEnvelopeDeadLetterSink.class);
|
||||||
|
|
||||||
|
assertTypeNotPresent(context, "com.lingniu.ingest.sink.archive.ArchiveStore");
|
||||||
|
assertTypeNotPresent(context, "com.lingniu.ingest.eventfilestore.EventFileStore");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private static KafkaProducer<String, byte[]> kafkaProducer() {
|
||||||
|
return mock(KafkaProducer.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void assertTypeNotPresent(ApplicationContext context, String className) {
|
||||||
|
assertThat(ClassUtils.isPresent(className, context.getClassLoader()))
|
||||||
|
.as("%s must stay outside the JT808 ingest runtime", className)
|
||||||
|
.isFalse();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.lingniu.ingest.jt808app;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
|
||||||
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
class Jt808IngestAppDefaultsTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void applicationDefaultsKeepJt808IngestAsTcpKafkaProducerOnly() {
|
||||||
|
Properties properties = applicationProperties();
|
||||||
|
|
||||||
|
assertThat(properties)
|
||||||
|
.containsEntry("spring.application.name", "jt808-ingest-app")
|
||||||
|
.containsEntry(
|
||||||
|
"spring.config.import[0]",
|
||||||
|
"optional:nacos:${spring.application.name}.${NACOS_CONFIG_FILE_EXTENSION:yml}?group=${NACOS_GROUP:DEFAULT_GROUP}&refreshEnabled=${NACOS_REFRESH_ENABLED:true}")
|
||||||
|
.containsEntry("spring.cloud.nacos.config.server-addr", "${NACOS_SERVER_ADDR:127.0.0.1:8848}")
|
||||||
|
.containsEntry("server.port", "${HTTP_PORT:20400}")
|
||||||
|
.containsEntry("lingniu.ingest.jt808.enabled", true)
|
||||||
|
.containsEntry("lingniu.ingest.jt808.port", "${JT808_PORT:10808}")
|
||||||
|
.containsEntry("lingniu.ingest.sink.mq.enabled", "${KAFKA_ENABLED:true}")
|
||||||
|
.containsEntry("lingniu.ingest.sink.mq.consumer.enabled", false)
|
||||||
|
.containsEntry("lingniu.ingest.sink.mq.topics.realtime", "${KAFKA_TOPIC_JT808_EVENT:vehicle.event.jt808.v1}")
|
||||||
|
.containsEntry("lingniu.ingest.sink.mq.topics.raw-archive", "${KAFKA_TOPIC_JT808_RAW:vehicle.raw.jt808.v1}")
|
||||||
|
.containsEntry("lingniu.ingest.sink.mq.topics.dlq", "${KAFKA_TOPIC_JT808_DLQ:vehicle.dlq.jt808.v1}")
|
||||||
|
.containsEntry("lingniu.ingest.event-file-store.enabled", false)
|
||||||
|
.containsEntry("lingniu.ingest.event-history.enabled", false)
|
||||||
|
.containsEntry("lingniu.ingest.vehicle-state.enabled", false)
|
||||||
|
.containsEntry("lingniu.ingest.vehicle-stat.enabled", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Properties applicationProperties() {
|
||||||
|
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
|
||||||
|
factory.setResources(new ClassPathResource("application.yml"));
|
||||||
|
|
||||||
|
Properties properties = factory.getObject();
|
||||||
|
|
||||||
|
assertThat(properties).isNotNull();
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,6 +41,10 @@
|
|||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
|||||||
@@ -21,6 +21,12 @@ spring:
|
|||||||
server:
|
server:
|
||||||
port: ${HTTP_PORT:20300}
|
port: ${HTTP_PORT:20300}
|
||||||
|
|
||||||
|
springdoc:
|
||||||
|
swagger-ui:
|
||||||
|
path: /swagger-ui.html
|
||||||
|
api-docs:
|
||||||
|
path: /v3/api-docs
|
||||||
|
|
||||||
lingniu:
|
lingniu:
|
||||||
ingest:
|
ingest:
|
||||||
gb32960:
|
gb32960:
|
||||||
|
|||||||
@@ -49,6 +49,10 @@
|
|||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
|||||||
@@ -21,6 +21,12 @@ spring:
|
|||||||
server:
|
server:
|
||||||
port: ${HTTP_PORT:20200}
|
port: ${HTTP_PORT:20200}
|
||||||
|
|
||||||
|
springdoc:
|
||||||
|
swagger-ui:
|
||||||
|
path: /swagger-ui.html
|
||||||
|
api-docs:
|
||||||
|
path: /v3/api-docs
|
||||||
|
|
||||||
lingniu:
|
lingniu:
|
||||||
ingest:
|
ingest:
|
||||||
gb32960:
|
gb32960:
|
||||||
|
|||||||
6
pom.xml
6
pom.xml
@@ -37,6 +37,7 @@
|
|||||||
<module>modules/inbound/inbound-xinda-push</module>
|
<module>modules/inbound/inbound-xinda-push</module>
|
||||||
<module>modules/apps/command-gateway</module>
|
<module>modules/apps/command-gateway</module>
|
||||||
<module>modules/apps/gb32960-ingest-app</module>
|
<module>modules/apps/gb32960-ingest-app</module>
|
||||||
|
<module>modules/apps/jt808-ingest-app</module>
|
||||||
<module>modules/apps/vehicle-history-app</module>
|
<module>modules/apps/vehicle-history-app</module>
|
||||||
<module>modules/apps/vehicle-analytics-app</module>
|
<module>modules/apps/vehicle-analytics-app</module>
|
||||||
</modules>
|
</modules>
|
||||||
@@ -237,6 +238,11 @@
|
|||||||
<artifactId>gb32960-ingest-app</artifactId>
|
<artifactId>gb32960-ingest-app</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.lingniu.ingest</groupId>
|
||||||
|
<artifactId>jt808-ingest-app</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lingniu.ingest</groupId>
|
<groupId>com.lingniu.ingest</groupId>
|
||||||
<artifactId>vehicle-history-app</artifactId>
|
<artifactId>vehicle-history-app</artifactId>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ steps:
|
|||||||
commands: |
|
commands: |
|
||||||
cd $CI_WORKSPACE
|
cd $CI_WORKSPACE
|
||||||
|
|
||||||
mvn -B -ntp -am -pl :gb32960-ingest-app,:vehicle-history-app,:vehicle-analytics-app package -DskipTests
|
mvn -B -ntp -am -pl :gb32960-ingest-app,:jt808-ingest-app,:vehicle-history-app,:vehicle-analytics-app package -DskipTests
|
||||||
|
|
||||||
BRANCH_NAME=$(echo ${CI_COMMIT_BRANCH:-local} | tr / -)
|
BRANCH_NAME=$(echo ${CI_COMMIT_BRANCH:-local} | tr / -)
|
||||||
PROJECT_VERSION=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version)
|
PROJECT_VERSION=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version)
|
||||||
@@ -60,6 +60,42 @@ steps:
|
|||||||
|
|
||||||
docker push $IMAGE
|
docker push $IMAGE
|
||||||
|
|
||||||
|
- name: docker-build-jt808-ingest-app
|
||||||
|
image: docker:24.0.5-cli
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
- pull_request
|
||||||
|
- manual
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
- main
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
environment:
|
||||||
|
ALIYUN_ACR_USERNAME:
|
||||||
|
from_secret: aliyun_acr_username
|
||||||
|
ALIYUN_ACR_PASSWORD:
|
||||||
|
from_secret: aliyun_acr_password
|
||||||
|
commands: |
|
||||||
|
cd $CI_WORKSPACE
|
||||||
|
APP_NAME=jt808-ingest-app
|
||||||
|
APP_VERSION=$(cat $CI_WORKSPACE/project_version.txt)
|
||||||
|
IMAGE=crpi-85r4m0ackrm3qpje.cn-shanghai.personal.cr.aliyuncs.com/oneos/$APP_NAME:$APP_VERSION
|
||||||
|
|
||||||
|
docker build \
|
||||||
|
--build-arg APP_NAME=$APP_NAME \
|
||||||
|
--build-arg APP_VERSION=$APP_VERSION \
|
||||||
|
-t $IMAGE .
|
||||||
|
|
||||||
|
printf '%s' "$ALIYUN_ACR_PASSWORD" | docker login \
|
||||||
|
--username "$ALIYUN_ACR_USERNAME" \
|
||||||
|
--password-stdin \
|
||||||
|
crpi-85r4m0ackrm3qpje.cn-shanghai.personal.cr.aliyuncs.com
|
||||||
|
|
||||||
|
docker push $IMAGE
|
||||||
|
|
||||||
- name: docker-build-vehicle-history-app
|
- name: docker-build-vehicle-history-app
|
||||||
image: docker:24.0.5-cli
|
image: docker:24.0.5-cli
|
||||||
when:
|
when:
|
||||||
|
|||||||
Reference in New Issue
Block a user