mirror of
https://gitee.com/pnoker/iot-dc3.git
synced 2026-11-02 19:21:51 +08:00
feat(config): add dev/prod profiles and fix driver metadata receiver routing
This commit is contained in:
@@ -0,0 +1 @@
|
||||
# Product environment, customizable configuration
|
||||
@@ -1 +1 @@
|
||||
# Development environment, customizable configuration
|
||||
# Test environment, customizable configuration
|
||||
@@ -0,0 +1 @@
|
||||
# Product environment, customizable configuration
|
||||
@@ -1 +1 @@
|
||||
# Development environment, customizable configuration
|
||||
# Test environment, customizable configuration
|
||||
+1
-1
@@ -74,7 +74,7 @@ public class DriverSdkServiceImpl implements DriverSdkService {
|
||||
log.debug("Driver does not registered, adding {} ", driver);
|
||||
try {
|
||||
Driver byHostPort = driverService.selectByHostPort(driver.getType(), driver.getHost(), driver.getPort(), driver.getTenantId());
|
||||
throw new ServiceException("The port(" + driver.getPort() + ") is already occupied by driver(" + byHostPort.getName() + "/" + byHostPort.getServiceName() + ")");
|
||||
throw new ServiceException("The port(" + driver.getPort() + ") is already occupied by driver(" + byHostPort.getServiceName() + "/" + byHostPort.getName() + ")");
|
||||
} catch (NotFoundException notFoundException2) {
|
||||
driver = driverService.add(driver);
|
||||
}
|
||||
|
||||
+5
-5
@@ -48,7 +48,7 @@ public class NotifyServiceImpl implements NotifyService {
|
||||
notifyDriver(driver, operation);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.warn("Notify Driver Profile : {}", e.getMessage());
|
||||
log.warn("Notify Driver Profile: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class NotifyServiceImpl implements NotifyService {
|
||||
notifyDriver(driver, operation);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.warn("Notify Driver Point : {}", e.getMessage());
|
||||
log.warn("Notify Driver Point: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class NotifyServiceImpl implements NotifyService {
|
||||
DriverConfiguration operation = new DriverConfiguration().setType(Common.Driver.Type.DEVICE).setCommand(command).setContent(device);
|
||||
notifyDriver(driver, operation);
|
||||
} catch (Exception e) {
|
||||
log.warn("Notify Driver Device : {}", e.getMessage());
|
||||
log.warn("Notify Driver Device: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public class NotifyServiceImpl implements NotifyService {
|
||||
DriverConfiguration operation = new DriverConfiguration().setType(Common.Driver.Type.DRIVER_INFO).setCommand(command).setContent(driverInfo);
|
||||
notifyDriver(driver, operation);
|
||||
} catch (Exception e) {
|
||||
log.warn("Notify Driver DriverInfo : {}", e.getMessage());
|
||||
log.warn("Notify Driver DriverInfo: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ public class NotifyServiceImpl implements NotifyService {
|
||||
DriverConfiguration operation = new DriverConfiguration().setType(Common.Driver.Type.POINT_INFO).setCommand(command).setContent(pointInfo);
|
||||
notifyDriver(driver, operation);
|
||||
} catch (Exception e) {
|
||||
log.warn("Notify Driver PointInfo : {}", e.getMessage());
|
||||
log.warn("Notify Driver PointInfo: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
# Product environment, customizable configuration
|
||||
@@ -0,0 +1 @@
|
||||
# Product environment, customizable configuration
|
||||
@@ -0,0 +1 @@
|
||||
# Product environment, customizable configuration
|
||||
@@ -0,0 +1,13 @@
|
||||
driver:
|
||||
tenant: default
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: ${driver.project}_${driver.tenant}
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
mvc:
|
||||
throw-exception-if-no-handler-found: true
|
||||
web:
|
||||
resources:
|
||||
add-mappings: false
|
||||
+2
-2
@@ -92,7 +92,7 @@ public class DriverMetadataReceiver {
|
||||
*/
|
||||
private void configurationDriver(DriverConfiguration driverConfiguration) {
|
||||
if (!Common.Response.OK.equals(driverConfiguration.getResponse())) {
|
||||
driverService.close("The driver initialization failed {}", driverConfiguration.getResponse());
|
||||
driverService.close("The driver initialization failed: {}", driverConfiguration.getResponse());
|
||||
}
|
||||
|
||||
switch (driverConfiguration.getCommand()) {
|
||||
@@ -104,7 +104,7 @@ public class DriverMetadataReceiver {
|
||||
break;
|
||||
case Common.Driver.Event.DRIVER_METADATA_SYNC_BACK:
|
||||
DriverMetadata driverMetadata = Convert.convert(DriverMetadata.class, driverConfiguration.getContent());
|
||||
log.debug("Initialization driver metadata : {}", JsonUtil.toPrettyJsonString(driverMetadata));
|
||||
log.debug("Initialization driver metadata: {}", JsonUtil.toPrettyJsonString(driverMetadata));
|
||||
driverContext.setDriverMetadata(driverMetadata);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# Development environment, customizable configuration
|
||||
eureka:
|
||||
instance:
|
||||
# Custom node registration IP
|
||||
ip-address: ${SERVICE_HOST:192.168.0.103}
|
||||
|
||||
# Log config
|
||||
logging:
|
||||
level:
|
||||
com.dc3: DEBUG
|
||||
com.dc3.common.sdk: DEBUG
|
||||
@@ -0,0 +1 @@
|
||||
# Product environment, customizable configuration
|
||||
@@ -0,0 +1 @@
|
||||
# Test environment, customizable configuration
|
||||
@@ -1,6 +1,5 @@
|
||||
driver:
|
||||
name: EdgeGateway
|
||||
tenant: default
|
||||
type: gateway
|
||||
project: @project.artifactId@
|
||||
description: @project.description@
|
||||
@@ -58,12 +57,16 @@ server:
|
||||
port: 8702
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: ${driver.project}_${driver.tenant}
|
||||
profiles:
|
||||
active:
|
||||
- server
|
||||
- register
|
||||
- monitor
|
||||
- rabbitmq
|
||||
- quartz
|
||||
- driver
|
||||
- ${NODE_ENV:dev}
|
||||
|
||||
logging:
|
||||
level:
|
||||
com.dc3.common.sdk: DEBUG
|
||||
com.dc3: DEBUG
|
||||
file:
|
||||
name: dc3/logs/driver/mqtt/${spring.application.name}.log
|
||||
@@ -0,0 +1,11 @@
|
||||
# Development environment, customizable configuration
|
||||
eureka:
|
||||
instance:
|
||||
# Custom node registration IP
|
||||
ip-address: ${SERVICE_HOST:192.168.0.103}
|
||||
|
||||
# Log config
|
||||
logging:
|
||||
level:
|
||||
com.dc3: DEBUG
|
||||
com.dc3.common.sdk: DEBUG
|
||||
@@ -0,0 +1 @@
|
||||
# Product environment, customizable configuration
|
||||
@@ -0,0 +1 @@
|
||||
# Test environment, customizable configuration
|
||||
@@ -1,6 +1,5 @@
|
||||
driver:
|
||||
name: ListeningVirtualDriver
|
||||
tenant: default
|
||||
type: driver
|
||||
project: @project.artifactId@
|
||||
description: @project.description@
|
||||
@@ -65,8 +64,6 @@ server:
|
||||
port: 8700
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: ${driver.project}_${driver.tenant}
|
||||
profiles:
|
||||
active:
|
||||
- server
|
||||
@@ -74,18 +71,9 @@ spring:
|
||||
- monitor
|
||||
- rabbitmq
|
||||
- quartz
|
||||
- driver
|
||||
- ${NODE_ENV:dev}
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
mvc:
|
||||
throw-exception-if-no-handler-found: true
|
||||
web:
|
||||
resources:
|
||||
add-mappings: false
|
||||
|
||||
logging:
|
||||
level:
|
||||
com.dc3: DEBUG
|
||||
com.dc3.common.sdk: DEBUG
|
||||
file:
|
||||
name: dc3/logs/driver/listening-virtual/${spring.application.name}.log
|
||||
@@ -0,0 +1,11 @@
|
||||
# Development environment, customizable configuration
|
||||
eureka:
|
||||
instance:
|
||||
# Custom node registration IP
|
||||
ip-address: ${SERVICE_HOST:192.168.0.103}
|
||||
|
||||
# Log config
|
||||
logging:
|
||||
level:
|
||||
com.dc3: DEBUG
|
||||
com.dc3.common.sdk: DEBUG
|
||||
@@ -0,0 +1 @@
|
||||
# Product environment, customizable configuration
|
||||
@@ -0,0 +1 @@
|
||||
# Test environment, customizable configuration
|
||||
@@ -1,6 +1,5 @@
|
||||
driver:
|
||||
name: ModbusDriver
|
||||
tenant: default
|
||||
type: driver
|
||||
project: @project.artifactId@
|
||||
description: @project.description@
|
||||
@@ -71,8 +70,6 @@ server:
|
||||
port: 8604
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: ${driver.project}_${driver.tenant}
|
||||
profiles:
|
||||
active:
|
||||
- server
|
||||
@@ -80,16 +77,9 @@ spring:
|
||||
- monitor
|
||||
- rabbitmq
|
||||
- quartz
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
mvc:
|
||||
throw-exception-if-no-handler-found: true
|
||||
web:
|
||||
resources:
|
||||
add-mappings: false
|
||||
- driver
|
||||
- ${NODE_ENV:dev}
|
||||
|
||||
logging:
|
||||
level:
|
||||
com.dc3: DEBUG
|
||||
file:
|
||||
name: dc3/logs/driver/modbus-tcp/${spring.application.name}.log
|
||||
@@ -0,0 +1,11 @@
|
||||
# Development environment, customizable configuration
|
||||
eureka:
|
||||
instance:
|
||||
# Custom node registration IP
|
||||
ip-address: ${SERVICE_HOST:192.168.0.103}
|
||||
|
||||
# Log config
|
||||
logging:
|
||||
level:
|
||||
com.dc3: DEBUG
|
||||
com.dc3.common.sdk: DEBUG
|
||||
@@ -0,0 +1 @@
|
||||
# Product environment, customizable configuration
|
||||
@@ -0,0 +1 @@
|
||||
# Test environment, customizable configuration
|
||||
@@ -1,6 +1,5 @@
|
||||
driver:
|
||||
name: MqttDriver
|
||||
tenant: default
|
||||
type: driver
|
||||
project: @project.artifactId@
|
||||
description: @project.description@
|
||||
@@ -52,7 +51,7 @@ driver:
|
||||
name: driver/${spring.application.name}/gateway/+
|
||||
default-send-topic:
|
||||
qos: 1
|
||||
topic: default/${spring.application.name}
|
||||
name: default/${spring.application.name}
|
||||
keep-alive: 15
|
||||
completion-timeout: 3000
|
||||
|
||||
@@ -60,12 +59,16 @@ server:
|
||||
port: 8701
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: ${driver.project}_${driver.tenant}
|
||||
profiles:
|
||||
active:
|
||||
- server
|
||||
- register
|
||||
- monitor
|
||||
- rabbitmq
|
||||
- quartz
|
||||
- driver
|
||||
- ${NODE_ENV:dev}
|
||||
|
||||
logging:
|
||||
level:
|
||||
com.dc3.common.sdk: DEBUG
|
||||
com.dc3: DEBUG
|
||||
file:
|
||||
name: dc3/logs/driver/mqtt/${spring.application.name}.log
|
||||
@@ -0,0 +1,12 @@
|
||||
# Development environment, customizable configuration
|
||||
eureka:
|
||||
instance:
|
||||
# Custom node registration IP
|
||||
ip-address: ${SERVICE_HOST:192.168.0.103}
|
||||
|
||||
# Log config
|
||||
logging:
|
||||
level:
|
||||
com.dc3: DEBUG
|
||||
com.dc3.common.sdk: DEBUG
|
||||
com.freud.dcom.utgard.cases.*: INFO
|
||||
@@ -0,0 +1 @@
|
||||
# Product environment, customizable configuration
|
||||
@@ -0,0 +1 @@
|
||||
# Test environment, customizable configuration
|
||||
@@ -1,6 +1,5 @@
|
||||
driver:
|
||||
name: OpcDaDriver
|
||||
tenant: default
|
||||
type: driver
|
||||
project: @project.artifactId@
|
||||
description: @project.description@
|
||||
@@ -81,13 +80,16 @@ server:
|
||||
port: 8602
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: ${driver.project}_${driver.tenant}
|
||||
profiles:
|
||||
active:
|
||||
- server
|
||||
- register
|
||||
- monitor
|
||||
- rabbitmq
|
||||
- quartz
|
||||
- driver
|
||||
- ${NODE_ENV:dev}
|
||||
|
||||
logging:
|
||||
level:
|
||||
com.freud.dcom.utgard.cases.*: INFO
|
||||
com.dc3.common.sdk: DEBUG
|
||||
com.dc3: DEBUG
|
||||
file:
|
||||
name: dc3/logs/driver/opcda/${spring.application.name}.log
|
||||
@@ -0,0 +1,11 @@
|
||||
# Development environment, customizable configuration
|
||||
eureka:
|
||||
instance:
|
||||
# Custom node registration IP
|
||||
ip-address: ${SERVICE_HOST:192.168.0.103}
|
||||
|
||||
# Log config
|
||||
logging:
|
||||
level:
|
||||
com.dc3: DEBUG
|
||||
com.dc3.common.sdk: DEBUG
|
||||
@@ -0,0 +1 @@
|
||||
# Product environment, customizable configuration
|
||||
@@ -0,0 +1 @@
|
||||
# Test environment, customizable configuration
|
||||
@@ -1,6 +1,5 @@
|
||||
driver:
|
||||
name: OpcUaDriver
|
||||
tenant: default
|
||||
type: driver
|
||||
project: @project.artifactId@
|
||||
description: @project.description@
|
||||
@@ -71,11 +70,16 @@ server:
|
||||
port: 8603
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: ${driver.project}_${driver.tenant}
|
||||
profiles:
|
||||
active:
|
||||
- server
|
||||
- register
|
||||
- monitor
|
||||
- rabbitmq
|
||||
- quartz
|
||||
- driver
|
||||
- ${NODE_ENV:dev}
|
||||
|
||||
logging:
|
||||
level:
|
||||
com.dc3: DEBUG
|
||||
file:
|
||||
name: dc3/logs/driver/opcua/${spring.application.name}.log
|
||||
@@ -0,0 +1,11 @@
|
||||
# Development environment, customizable configuration
|
||||
eureka:
|
||||
instance:
|
||||
# Custom node registration IP
|
||||
ip-address: ${SERVICE_HOST:192.168.0.103}
|
||||
|
||||
# Log config
|
||||
logging:
|
||||
level:
|
||||
com.dc3: DEBUG
|
||||
com.dc3.common.sdk: DEBUG
|
||||
@@ -0,0 +1 @@
|
||||
# Product environment, customizable configuration
|
||||
@@ -0,0 +1 @@
|
||||
# Test environment, customizable configuration
|
||||
@@ -1,6 +1,5 @@
|
||||
driver:
|
||||
name: PlcS7Driver
|
||||
tenant: default
|
||||
type: driver
|
||||
project: @project.artifactId@
|
||||
description: @project.description@
|
||||
@@ -81,11 +80,16 @@ server:
|
||||
port: 8601
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: ${driver.project}_${driver.tenant}
|
||||
profiles:
|
||||
active:
|
||||
- server
|
||||
- register
|
||||
- monitor
|
||||
- rabbitmq
|
||||
- quartz
|
||||
- driver
|
||||
- ${NODE_ENV:dev}
|
||||
|
||||
logging:
|
||||
level:
|
||||
com.dc3: DEBUG
|
||||
file:
|
||||
name: dc3/logs/driver/plcs7/${spring.application.name}.log
|
||||
@@ -0,0 +1,14 @@
|
||||
# Development environment, customizable configuration
|
||||
eureka:
|
||||
instance:
|
||||
# Custom node registration IP
|
||||
ip-address: ${SERVICE_HOST:192.168.0.103}
|
||||
|
||||
# Log config
|
||||
logging:
|
||||
level:
|
||||
com.dc3: DEBUG
|
||||
com.dc3.common.sdk: DEBUG
|
||||
com.dc3.common.sdk.service: DEBUG
|
||||
com.dc3.common.sdk.service.job: DEBUG
|
||||
com.dc3.common.sdk.service.rabbit: DEBUG
|
||||
@@ -0,0 +1 @@
|
||||
# Product environment, customizable configuration
|
||||
@@ -0,0 +1 @@
|
||||
# Test environment, customizable configuration
|
||||
@@ -1,6 +1,5 @@
|
||||
driver:
|
||||
name: VirtualDriver
|
||||
tenant: default
|
||||
type: driver
|
||||
project: @project.artifactId@
|
||||
description: @project.description@
|
||||
@@ -51,14 +50,16 @@ server:
|
||||
port: 8600
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: ${driver.project}_${driver.tenant}
|
||||
profiles:
|
||||
active:
|
||||
- server
|
||||
- register
|
||||
- monitor
|
||||
- rabbitmq
|
||||
- quartz
|
||||
- driver
|
||||
- ${NODE_ENV:dev}
|
||||
|
||||
logging:
|
||||
level:
|
||||
com.dc3: DEBUG
|
||||
#com.dc3.common.sdk.service: INFO
|
||||
#com.dc3.common.sdk.service.job: INFO
|
||||
#com.dc3.common.sdk.service.rabbit: INFO
|
||||
file:
|
||||
name: dc3/logs/driver/virtual/${spring.application.name}.log
|
||||
@@ -687,7 +687,7 @@ services:
|
||||
image: pnoker/dc3-emqx:1.0.0
|
||||
restart: always
|
||||
ports:
|
||||
- 1883:1883
|
||||
#- 1883:1883
|
||||
- 8883:8883
|
||||
- 18083:18083
|
||||
container_name: dc3-emqx
|
||||
|
||||
Reference in New Issue
Block a user