1、连续无固定解改为每秒发一次冷启动,连续发10次
2、MQTT推送优化
This commit is contained in:
parent
30f8b822e8
commit
689f6cf360
@ -47,7 +47,12 @@ public class GZYMQTTForwarder extends Forwarder {
|
|||||||
void registerMe() throws MqttException {
|
void registerMe() throws MqttException {
|
||||||
init(FORWARDER_NAME, "MQTT "+brokerUrl,2,FWD_DEVICE_ALIAS_NAME,30);
|
init(FORWARDER_NAME, "MQTT "+brokerUrl,2,FWD_DEVICE_ALIAS_NAME,30);
|
||||||
mqttClient = new MQTTClient(brokerUrl, username, password,clientid);
|
mqttClient = new MQTTClient(brokerUrl, username, password,clientid);
|
||||||
mqttClient.connect();
|
try{
|
||||||
|
mqttClient.connect();
|
||||||
|
}
|
||||||
|
catch (Exception e){
|
||||||
|
logger.error("gzy mqtt connect failed: {}",e.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -57,8 +62,18 @@ public class GZYMQTTForwarder extends Forwarder {
|
|||||||
//@Scheduled(cron = "0 0/5 * * * ?") // 每30分钟执行一次
|
//@Scheduled(cron = "0 0/5 * * * ?") // 每30分钟执行一次
|
||||||
private void forwardGnss() {
|
private void forwardGnss() {
|
||||||
logger.debug("gzy mqtt forwardGnss");
|
logger.debug("gzy mqtt forwardGnss");
|
||||||
forwardCurrentGnss();
|
if(mqttClient.isConnected()) {
|
||||||
//forwardAngleData();
|
forwardCurrentGnss();
|
||||||
|
//forwardAngleData();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
try{
|
||||||
|
mqttClient.connect();
|
||||||
|
}
|
||||||
|
catch (Exception e){
|
||||||
|
logger.error("gzy mqtt connect failed: {}",e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -49,7 +49,12 @@ public class ZNYMQTTForwarder extends Forwarder {
|
|||||||
void registerMe() throws MqttException {
|
void registerMe() throws MqttException {
|
||||||
init(FORWARDER_NAME, "MQTT "+brokerUrl,4,FWD_DEVICE_ALIAS_NAME,30);
|
init(FORWARDER_NAME, "MQTT "+brokerUrl,4,FWD_DEVICE_ALIAS_NAME,30);
|
||||||
mqttClient = new MQTTClient(brokerUrl, username, password,clientid);
|
mqttClient = new MQTTClient(brokerUrl, username, password,clientid);
|
||||||
mqttClient.connect();
|
try{
|
||||||
|
mqttClient.connect();
|
||||||
|
}
|
||||||
|
catch (Exception e){
|
||||||
|
logger.error("zny mqtt connect failed: {}",e.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,8 +64,15 @@ public class ZNYMQTTForwarder extends Forwarder {
|
|||||||
@Scheduled(cron = "0 0/30 * * * ?") // 每30分钟执行一次
|
@Scheduled(cron = "0 0/30 * * * ?") // 每30分钟执行一次
|
||||||
private void forwardGnss() {
|
private void forwardGnss() {
|
||||||
logger.debug("zny mqtt forwardGnss");
|
logger.debug("zny mqtt forwardGnss");
|
||||||
forwardCurrentGnss();
|
if(mqttClient.isConnected()) forwardCurrentGnss();
|
||||||
//forwardAngleData();
|
else{
|
||||||
|
try{
|
||||||
|
mqttClient.connect();
|
||||||
|
}
|
||||||
|
catch (Exception e){
|
||||||
|
logger.error("zny mqtt connect failed: {}",e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user