Added script to measure connetion timing
This commit is contained in:
@@ -11,6 +11,7 @@ Version 0.7:
|
|||||||
Removed OSGi bundle, developer time burner
|
Removed OSGi bundle, developer time burner
|
||||||
Fixed github issue #30, returning error on mapdb file not deleted that corrupt reiterated builds
|
Fixed github issue #30, returning error on mapdb file not deleted that corrupt reiterated builds
|
||||||
Added handling of allow_anonymous clients (as in mosquitto issue #34)
|
Added handling of allow_anonymous clients (as in mosquitto issue #34)
|
||||||
|
Modified the password_file format to use password soterd in sha256 and not plain text
|
||||||
|
|
||||||
Version 0.6:
|
Version 0.6:
|
||||||
Fix issue #42, bad password file path composition
|
Fix issue #42, bad password file path composition
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
@GrabResolver(name='Paho', root='https://repo.eclipse.org/content/repositories/paho-releases/')
|
||||||
|
@Grab(group='org.eclipse.paho', module='mqtt-client', version='0.4.0')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ths script is meant to measure the connection mean time from a client.
|
||||||
|
* It loops connecting and disconnecting to the broker.
|
||||||
|
* */
|
||||||
|
|
||||||
|
import org.eclipse.paho.client.mqttv3.MqttClient
|
||||||
|
import org.eclipse.paho.client.mqttv3.MqttMessage
|
||||||
|
import org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence
|
||||||
|
|
||||||
|
String tmpDir = System.getProperty("java.io.tmpdir")
|
||||||
|
MqttDefaultFilePersistence dataStore = new MqttDefaultFilePersistence(tmpDir)
|
||||||
|
|
||||||
|
MqttClient client = new MqttClient("tcp://localhost:1883", "ReconnectingClient", dataStore)
|
||||||
|
10.times {
|
||||||
|
println "conneting.."
|
||||||
|
long start = System.currentTimeMillis()
|
||||||
|
client.connect()
|
||||||
|
long time = System.currentTimeMillis() - start
|
||||||
|
print "took ${time} ms "
|
||||||
|
|
||||||
|
MqttMessage message = new MqttMessage('Hello world!!'.bytes)
|
||||||
|
message.setQos(0)
|
||||||
|
long startPub = System.currentTimeMillis()
|
||||||
|
client.getTopic("log").publish(message)
|
||||||
|
long pubTime = System.currentTimeMillis() - startPub
|
||||||
|
print " pub (qos 0): ${pubTime} ms "
|
||||||
|
|
||||||
|
client.disconnect()
|
||||||
|
println "disconnected"
|
||||||
|
}
|
||||||
|
println "Finished"
|
||||||
Reference in New Issue
Block a user