环境信息
- EMQ X 版本:4.3.10
- 操作系统及版本:
- 其他
问题描述
1.配置了自动重连
2.连接超时后未自动重连
日志如下:
[2021-12-13 12:46:46:268] ERROR[MQTT Ping: client-6ee260dc-45ed-4b5e-a9da-84670cdf0a3c]org.eclipse.paho.client.mqttv3.internal.ClientState.logToJsr47:210 - client-6ee260dc-45ed-4b5e-a9da-84670cdf0a3c: Timed out as no activity, keepAlive=5,000,000,000 lastOutboundActivity=321,248,045,144,832 lastInboundActivity=321,244,434,781,706 time=321,253,045,145,112 lastPing=321,248,045,150,850,
[2021-12-13 12:46:46:273] WARN [MQTT Ping: client-6ee260dc-45ed-4b5e-a9da-84670cdf0a3c]c.c.p.m.b.m.autoconfigure.MqttConnector.connectionLost:169 - Mqtt connection lost.,
3.以下情况是会自动重连时的日志:
[2021-12-13 12:44:25:394] WARN [MQTT Rec: client-6ee260dc-45ed-4b5e-a9da-84670cdf0a3c]c.c.p.m.b.m.autoconfigure.MqttConnector.connectionLost:169 - Mqtt connection lost.
[2021-12-13 12:44:26:710] INFO [MQTT Call: client-6ee260dc-45ed-4b5e-a9da-84670cdf0a3c]c.c.p.m.b.m.autoconfigure.MqttConnector.connectComplete:162 - Mqtt reconnection success.
[2021-12-13 12:44:26:712] INFO [MQTT Call: client-6ee260dc-45ed-4b5e-a9da-84670cdf0a3c]c.c.p.m.b.m.autoconfigure.MqttConnector.subscribe:217 - Mqtt client 'client-6ee260dc-45ed-4b5e-a9da-84670cdf0a3c' subscribe success. topics
区别是日志中:MQTT rec时 lost会自动重连
MQTT ping不会自动重连