Open Agoni-sudo opened 1 month ago
Given the line
2024-10-30 14:16:17.110 INFO 30908 --- [tLoopGroup-3-19] i.m.broker.metrics.MQTTMessageLogger : Channel Inactive
I'm guessing that your connection is timing out. Can you try turning on keep-alive messages, or increasing the keep-alive frequency?
给定线路
2024-10-30 14:16:17.110 INFO 30908 --- [tLoopGroup-3-19] i.m.broker.metrics.MQTTMessageLogger : Channel Inactive
我猜您的连接超时了。您可以尝试打开保持活动消息或提高保持活动频率吗?
public MqttConnectOptions mqttConnectOptions() { MqttConnectOptions options = new MqttConnectOptions(); options.setServerURIs(new String[]{hostUrl}); //options.setUserName(""); // options.setPassword("".toCharArray()); options.setConnectionTimeout(20); options.setKeepAliveInterval(30); options.setWill(willTopic, willData, 2, false); // 设置遗嘱消息 return options; } Is it keeplive of mqtt? On the client side, I set the heartbeat rate to 30s, but it still disconnects after a period of time
You can view this method initializeKeepAliveTimeout
The keeplive in the broker comes from the MQTT message
The paho-client library repeatedly disconnects and connects when creating a client connection to moquette. This does not happen when connecting with the mqttx test tool but drops and reconnects every 8 minutes or so
2024-10-30 14:16:06.387 INFO 30908 --- [tLoopGroup-3-18] i.m.broker.metrics.MQTTMessageLogger : C->B CONNECT
2024-10-30 14:16:06.388 INFO 30908 --- [pool-2-thread-1] c.b.mqttImp.SafetyInterceptHandler : 连接:io.moquette.interception.messages.InterceptConnectMessage@40bea6d2
2024-10-30 14:16:06.395 INFO 30908 --- [tLoopGroup-3-18] i.m.broker.metrics.MQTTMessageLogger : C->B SUBSCRIBE to topics [MqttTopicSubscription[topicFilter=Mosquitto_bridge, option=SubscriptionOption[qos=AT_MOST_ONCE, noLocal=false, retainAsPublished=false, retainHandling=SEND_AT_SUBSCRIBE]]]
2024-10-30 14:16:06.395 INFO 30908 --- [tLoopGroup-3-18] i.m.broker.metrics.MQTTMessageLogger : C<-B SUBACK packetID <1>, grantedQoses [0]
2024-10-30 14:16:06.396 INFO 30908 --- [pool-2-thread-1] c.b.mqttImp.SafetyInterceptHandler : 客户端 mqtt_fx0604 订阅主题:Mosquitto_bridge
2024-10-30 14:16:06.753 INFO 30908 --- [tLoopGroup-3-19] i.m.broker.metrics.MQTTMessageLogger : C->B CONNECT
2024-10-30 14:16:06.756 INFO 30908 --- [tLoopGroup-3-18] i.m.broker.metrics.MQTTMessageLogger : Channel Inactive
2024-10-30 14:16:06.756 INFO 30908 --- [pool-2-thread-1] c.b.mqttImp.SafetyInterceptHandler : 连接:io.moquette.interception.messages.InterceptConnectMessage@570486df
2024-10-30 14:16:06.756 INFO 30908 --- [tLoopGroup-3-18] io.moquette.broker.MQTTConnection : Notifying connection lost event
2024-10-30 14:16:06.756 INFO 30908 --- [pool-2-thread-1] c.b.mqttImp.SafetyInterceptHandler : 连接丢失:mqtt_fx0604
2024-10-30 14:16:06.757 INFO 30908 --- [tLoopGroup-3-19] i.m.broker.metrics.MQTTMessageLogger : C->B SUBSCRIBE to topics [MqttTopicSubscription[topicFilter=online01Topic, option=SubscriptionOption[qos=AT_LEAST_ONCE, noLocal=false, retainAsPublished=false, retainHandling=SEND_AT_SUBSCRIBE]]]
2024-10-30 14:16:06.757 INFO 30908 --- [tLoopGroup-3-19] i.m.broker.metrics.MQTTMessageLogger : C<-B SUBACK packetID <1>, grantedQoses [1]
2024-10-30 14:16:06.757 INFO 30908 --- [pool-2-thread-1] c.b.mqttImp.SafetyInterceptHandler : 客户端 mqtt_fx0604 订阅主题:online01Topic
2024-10-30 14:16:06.760 INFO 30908 --- [tLoopGroup-3-19] i.m.broker.metrics.MQTTMessageLogger : C<-B PUBACK packetID <2>
2024-10-30 14:16:06.760 INFO 30908 --- [pool-2-thread-1] c.b.mqttImp.SafetyInterceptHandler : 发送数据:主题 = online01Topic, 内容 = online01
2024-10-30 14:16:07.422 INFO 30908 --- [tLoopGroup-3-19] i.m.broker.metrics.MQTTMessageLogger : C->B PUBACK packetID <1>
2024-10-30 14:16:17.108 INFO 30908 --- [tLoopGroup-3-20] i.m.broker.metrics.MQTTMessageLogger : C->B CONNECT
2024-10-30 14:16:17.110 INFO 30908 --- [tLoopGroup-3-19] i.m.broker.metrics.MQTTMessageLogger : Channel Inactive
2024-10-30 14:16:17.111 INFO 30908 --- [tLoopGroup-3-19] io.moquette.broker.MQTTConnection : Notifying connection lost event
2024-10-30 14:16:17.111 INFO 30908 --- [pool-2-thread-1] c.b.mqttImp.SafetyInterceptHandler : 连接:io.moquette.interception.messages.InterceptConnectMessage@73dea4e
2024-10-30 14:16:17.111 INFO 30908 --- [pool-2-thread-1] c.b.mqttImp.SafetyInterceptHandler : 连接丢失:mqtt_fx0604
2024-10-30 14:16:17.111 INFO 30908 --- [tLoopGroup-3-20] i.m.broker.metrics.MQTTMessageLogger : C->B SUBSCRIBE to topics [MqttTopicSubscription[topicFilter=Mosquitto_bridge, option=SubscriptionOption[qos=AT_MOST_ONCE, noLocal=false, retainAsPublished=false, retainHandling=SEND_AT_SUBSCRIBE]]]
2024-10-30 14:16:17.111 INFO 30908 --- [tLoopGroup-3-20] i.m.broker.metrics.MQTTMessageLogger : C<-B SUBACK packetID <1>, grantedQoses [0]
2024-10-30 14:16:17.111 INFO 30908 --- [pool-2-thread-1] c.b.mqttImp.SafetyInterceptHandler : 客户端 mqtt_fx0604 订阅主题:Mosquitto_bridge