|
@@ -25,6 +25,8 @@ public class ConsumerMQTT {
|
|
|
options.setConnectionTimeout(10);
|
|
|
// 设置会话心跳时间 单位为秒 服务器会每隔1.5*20秒的时间向客户端发送个消息判断客户端是否在线,但这个方法并没有重连的机制
|
|
|
options.setKeepAliveInterval(20);
|
|
|
+ //设置为0,防止ERROR
|
|
|
+ options.setExecutorServiceTimeout(0);
|
|
|
//设置断开后重新连接
|
|
|
options.setAutomaticReconnect(true);
|
|
|
// 设置回调
|