You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package com.xydl.util;
|
|
|
|
|
|
|
|
import com.xydl.service.impl.MqttServiceImpl;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
@Component
|
|
|
|
@Slf4j
|
|
|
|
public class Subscribe {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
MqttUtil mqttUtil;
|
|
|
|
|
|
|
|
private static Subscribe single = new Subscribe();
|
|
|
|
|
|
|
|
@PostConstruct
|
|
|
|
private void SubscribeMqtt() {
|
|
|
|
// log.info("开始订阅===subScribe执行一次==={}", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
|
|
// mqttUtil.subScribeMQTT();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static Subscribe getInstance() {
|
|
|
|
return single;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|