jiazx0107@163.com
2023-10-23 e5c5137e91c04fff001d439d64ed5a253e3fc8da
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package com.fzzy.mqtt;
 
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
 
/**
 * MQTT 配置信息
 */
@Component
@ConfigurationProperties("mqtt")
@Data
public class MqttProperties {
 
    /**
     * 连接地址
     */
    private String host;
 
    /**
     * 用户名
     */
    private String clientUsername;
 
    /**
     * 密码
     */
    private String clientPassword;
 
 
    /**
     * 客户端Id,同一台服务器下,不允许出现重复的客户端id
     */
    private String clientId;
 
 
    /**
     * 超时时间
     */
    private int clientTimeout;
 
    /**
     * 设置会话心跳时间 单位为秒 服务器会每隔1.5*20秒的时间向客户端
     * 发送个消息判断客户端是否在线,但这个方法并没有重连的机制
     */
    private int clientAliveTime;
 
    private int clientMaxConnectTime;
 
    private String clientTopics;
 
    /**
     * 连接方式
     */
    private Integer clientQos;
 
    /**
     * 默认连接主题,以/#结尾表示订阅所有以test开头的主题
     */
    private String  defaultTopic;
 
    /**
     * 设置是否清空session,这里如果设置为false表示服务器会保留客户端的连
     * 接记录,这里设置为true表示每次连接到服务器都以新的身份连接
     */
    private Boolean cleanSession;
 
    /**
     * 是否断线重连
     */
    private Boolean reconnect;
 
    /**
     * 启动的时候是否关闭mqtt
     */
    private Boolean isOpen;
 
}