rKuion
rKuion

Reputation: 92

Paho client for java generating folder like paho101658642587966-tcp1270011883. what is the importance of this?

I am using Paho client for java to connect to activeMq over mqtt. I noticed one strange thing. There are several folder created having names like "paho101658642587966-tcp1270011883" and having empty .lck files. Why are these used and when are they created.

Upvotes: 2

Views: 2890

Answers (2)

Dharmender Rawat
Dharmender Rawat

Reputation: 715

You can specify the /tmp directory for client execution as:

String receiverId = UUID.randomUUID().toString();

IMqttClient receiver = new MqttClient(
                "tcp://" + properties.getProperty("host") + ":" + properties.getProperty("port"), receiverId, new MqttDefaultFilePersistence("/tmp"));

Upvotes: 2

hardillb
hardillb

Reputation: 59731

These files are created to store inflight messages for QOS2 message before their delivery to the broker can be confirmed.

They are created by the MQTTDefaultFilePersistence class, you can change the directory name and path by creating your own MQTTDefaultFilePresistence object and passing it to the MQTTClient constructor.

You can also switch to a in memory store, but this will change how QOS2 messages are handled if the client crashes before a delivery can be confirmed.

Upvotes: 7

Related Questions