| | |
| | | package com.fzzy.mqtt; |
| | | |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * MQTT 配置信息 |
| | | */ |
| | | @Component |
| | | @ConfigurationProperties("mqtt") |
| | | @Slf4j |
| | | @Data |
| | | @Component |
| | | @ConfigurationProperties("spring.mqtt") |
| | | public class MqttProperties { |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 超时时间 |
| | | */ |
| | | private int clientTimeout; |
| | | private int clientTimeout = 5000; |
| | | |
| | | /** |
| | | * 设置会话心跳时间 单位为秒 服务器会每隔1.5*20秒的时间向客户端 |
| | | * 发送个消息判断客户端是否在线,但这个方法并没有重连的机制 |
| | | */ |
| | | private int clientAliveTime; |
| | | private int clientAliveTime = 30000; |
| | | |
| | | private int clientMaxConnectTime; |
| | | |
| | |
| | | /** |
| | | * 连接方式 |
| | | */ |
| | | private Integer clientQos; |
| | | private Integer clientQos = 0; |
| | | |
| | | /** |
| | | * 默认连接主题,以/#结尾表示订阅所有以test开头的主题 |
| | | */ |
| | | private String defaultTopic; |
| | | private String defaultTopic; |
| | | |
| | | /** |
| | | * 设置是否清空session,这里如果设置为false表示服务器会保留客户端的连 |
| | |
| | | */ |
| | | private Boolean isOpen; |
| | | |
| | | |
| | | } |