Merge remote-tracking branch 'origin/main' into main

main
HuangHuiKang 6 days ago
commit f577a93129

@ -8,6 +8,7 @@ import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ApplicationListener;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@ -26,6 +27,7 @@ public class DefaultMqttStarter implements ApplicationListener<ApplicationReadyE
@SneakyThrows
@Override
@Order(1) //client先启动后再订阅
public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
// catch异常不然连不上emqx项目就跑不起来
try {

@ -18,6 +18,7 @@ import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.DependsOn;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Service;
@ -46,6 +47,7 @@ public class MqttserviceImpl implements IMqttservice, ApplicationListener<Applic
@Override
@Order(2)
public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
new Thread(() -> {
subscribeMysqlTopic();

Loading…
Cancel
Save