|
|
|
|
@ -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 {
|
|
|
|
|
|