java - how to clear ALL retained mqtt messages from mosquitto -


i've seen mosquitto_pub -h [server] -r -n -t [xyz] syntax clearing out 1 off messages. problem device developers have posted lot of garbage messages. have java/paho code base i'd modify automatically needed, can't seem publish 0 byte message. tried

client.publish(topic,null); 

but didn't seem work.

any suggestions on how delete everything, en mass.

there 2 options using paho client code depending on of 2 publish methods use.

mqttmessage msg = new mqttmessage(new byte[0]); msg.setretained(true); client.publish(topic, msg); 

or

client.publish(topic, new byte[0],0,true); 

the other option stop mosquitto , delete persistence file , restart


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -