How to resolve "Persistence already in use (32200)" [message #1699138] |
Sun, 21 June 2015 22:54  |
Eclipse User |
|
|
|
Hello,
I use mqttv3 client(java), when i publish message (height frequency) i get error "Persistence already in use (32200)"
Thank you.
Here my code
try {
MqttClient client = new MqttClient("tcp://localhost:1884", MqttAsyncClient.generateClientId());
client.setCallback(new MqttCallback() {
@Override
public void messageArrived(String arg0, MqttMessage arg1) throws Exception {
log.info("messageArrived");
}
@Override
public void deliveryComplete(IMqttDeliveryToken arg0) {
log.info("deliveryComplete");
}
@Override
public void connectionLost(Throwable arg0) {
log.info("connectionLost");
}
});
MqttClient before connecting to broker
client.connect();
client.publish(topicName, payload, qos, true);
String time = new Timestamp(System.currentTimeMillis()).toString();
log.info(String.format("Publishing at:%s to Topic:%s Message:%s", time, topicName, new String(payload)));
Thread.sleep(2000);
client.disconnect();
} catch (MqttException ex) {
log.error(ex);
throw new RuntimeException(ex.getMessage());
} catch (InterruptedException ex) {
log.error(ex);
}
|
|
|
Re: How to resolve "Persistence already in use (32200)" [message #1702272 is a reply to message #1699138] |
Tue, 21 July 2015 05:05  |
Eclipse User |
|
|
|
If you are disconnecting and connecting each time you publish, then the disconnect may be taking a little while before you try to reconnect again. If you are publishing "with high frequency" then it would be better to keep a connection open, and just call publish when you want to send a message.
|
|
|
Powered by
FUDForum. Page generated in 0.40314 seconds