mosquitto-users team mailing list archive
-
mosquitto-users team
-
Mailing list archive
-
Message #00269
How to persist message in mosquitto
I am newbie in mosquitto , I installed mosquitto-1.1.2-install-win32.exe in win7-64 system. When I want to use mosquitto persistent feature , I found no mosquitto.db is created. I have modified everyting i Know , but not works. Any help will be appreciated :D . the Attachment is my config file.below is some test java code:
pub message:
MqttClient client = new MqttClient("tcp://localhost:1883", "SampleClient");
client.connect();
MqttMessage message = new MqttMessage("Hello world11".getBytes());
message.setQos(1);
while(true){
client.getTopic("sensors/temperature").publish(message);
Thread.sleep(1000);
}
sub message:
new Thread(new Runnable(){
public void run() {
// TODO Auto-generated method stub
final String clientname = String.valueOf(Math.random());
try {
MqttClient client = new MqttClient("tcp://localhost:1883", clientname);
client.connect();
while(true){
SimpleCallbackHandler simpleCallbackHandler = new SimpleCallbackHandler();
client.setCallback(simpleCallbackHandler);
client.subscribe("sensors/temperature",0);
Thread.sleep(1000);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}).start();
Attachment:
mosquitto.conf
Description: Binary data
Follow ups