In a Java project I'm using the Eclipse Paho MQTT library. Into the project root I have a lot of folders like c32adeb3-f556-4563-afbe-8417b1de74ea-tcp1270018883
cointaining a .lck
file.
Can I delete all these folders? When can I delete them?
In a Java project I'm using the Eclipse Paho MQTT library. Into the project root I have a lot of folders like c32adeb3-f556-4563-afbe-8417b1de74ea-tcp1270018883
cointaining a .lck
file.
Can I delete all these folders? When can I delete them?
The reason is simple, this is because when you don't pass the persistence type explicitly MqttClient will use the MqttDefaultFilePersistence by default:
public MqttClient(String serverURI, String clientId) throws MqttException {
this(serverURI, clientId, new MqttDefaultFilePersistence());
}
You can ignore .lck files by setting persistence type explicitly to null or an instance of MemoryPersistence class:
client = new MqttClient("tcp://ip_of_server:1883", client_id, null);
or
client = new MqttClient("tcp://ip_of_server:1883", client_id, new MemoryPersistence());
These are the folders for handling message persistence for QOS 1 or 2 messages.
If you are seeing multiple directories being created that means you are generating fresh client ids for each connection which implies that you are not worried about messages high QOS delivery across restarts. Then I suggest switch to using the Memory backed persistence store rather than the filesystem based version.
© 2022 - 2024 — McMap. All rights reserved.