2021与蓝度共同重构项目,服务端
Van333
2022-12-29 727a69f859060093e685582fa10e5de82dcc138a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.sandu.ximon.admin.manager.iot.amqp;
 
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
 
import javax.annotation.PostConstruct;
 
/**
 * @author chenjiantian
 * @date 2021/12/2 17:45
 */
@Component
//@AllArgsConstructor
public class InitAmqpListener {
 
    @Autowired
    private MqttMainBoardConfig mqttMainBoardConfig;
    @Value("${listenter.isOpen}")
    private boolean isOpen;
 
    @PostConstruct
    public void initListener() throws Exception {
        if (isOpen) {
            new AmqpClient(
                    mqttMainBoardConfig
            ).execute();
        }
    }
}