我的服务使用paho mqtt时出现问题。它超时但没有连接丢失的报告。有没有人有解决这个问题的办法?如何解决此问题mqtt Paho超时但未报告连接丢失
public void connect(String client_id) {
String tmpDir = System.getProperty("java.io.tmpdir");
MqttDefaultFilePersistence dataStore = new MqttDefaultFilePersistence(tmpDir);
MqttConnectOptions options = new MqttConnectOptions();
options.setKeepAliveInterval(120);
try {
_client = new MqttClient(_url, MqttClient.generateClientId(), dataStore);
_client.connect(options);
_client.setCallback(this);
_client.subscribe(TOPIC);
LOGGER.info("Subscribed to " + Arrays.toString(TOPIC));
LOGGER.info("MAX CORES " + MAX_CORES);
} catch (MqttException e) {
LOGGER.log(Level.INFO, "Mosquitto Error: " + e.fillInStackTrace());
connect(null);
}
}
@Override
public void messageArrived(final String topic, final MqttMessage message) throws Exception {
threadPool.execute(new Runnable(){// code});
}
使用MQTT v 1.0.0
Nov 6, 2015 2:36:52 AM org.eclipse.paho.client.mqttv3.internal.ClientState checkForActivity
SEVERE: paho-595916529752865: Timed out as no activity, keepAlive=120,000 lastOutboundActivity=1,446,777,172,455 lastInboundActivity=1,446,777,117,734 time=1,446,777,412,455 lastPing=1,446,777,172,454
2015-11-05
david
+0
你将不得不给我们一些更多的上下文给任何人来帮助。诸如此类,它是否超时作为连接的一部分,或者经过一段时间不发送数据之后?您设置了什么KeepAlive期限? –
+0
原来是60秒,现在我改为120秒 –
+0
在这个问题上有什么好运? –