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 配置信息
|
*/
|
@Slf4j
|
@Data
|
@Component
|
@ConfigurationProperties("spring.mqtt")
|
public class MqttProperties {
|
|
/**
|
* 连接地址
|
*/
|
private String host;
|
|
/**
|
* 用户名
|
*/
|
private String username;
|
|
/**
|
* 密码
|
*/
|
private String password;
|
|
|
/**
|
* 客户端Id
|
*/
|
private String clientInId;
|
|
/**
|
* 客户端Id
|
*/
|
private String clientOutId;
|
|
/**
|
* 超时时间
|
*/
|
private int completionTimeout = 5000;
|
|
/**
|
* 设置会话心跳时间 单位为秒 服务器会每隔1.5*20秒的时间向客户端
|
* 发送个消息判断客户端是否在线,但这个方法并没有重连的机制
|
*/
|
private int keepAliveInterval = 20;
|
|
private int maxConnectTimes = 5;
|
|
private String topics;
|
|
/**
|
* 连接方式
|
*/
|
private Integer qos = 0;
|
|
/**
|
* 默认连接主题,以/#结尾表示订阅所有以test开头的主题
|
*/
|
private String defaultTopic;
|
|
/**
|
* 是否断线重连
|
*/
|
private Boolean reconnect;
|
|
/**
|
* 启动的时候是否关闭mqtt
|
*/
|
private Boolean isOpen;
|
|
|
}
|