This commit is contained in:
@ -6,11 +6,12 @@ class MqttSubscriber : MqttCallbackExtended {
|
||||
private val broker = "tcp://mqtt.k8s.kmlabz.com:1883"
|
||||
private val clientId = MqttClient.generateClientId()
|
||||
private val persistence = MemoryPersistence()
|
||||
private val mqttClient = MqttClient(broker, clientId, persistence)
|
||||
private val mqttClient = MqttAsyncClient(broker, clientId, persistence)
|
||||
private val benchValues = HashMap<Int, Instant>()
|
||||
|
||||
override fun connectionLost(arg0: Throwable) {
|
||||
System.err.println("connection lost")
|
||||
mqttClient.reconnect()
|
||||
}
|
||||
|
||||
override fun deliveryComplete(arg0: IMqttDeliveryToken) {
|
||||
@ -21,7 +22,6 @@ class MqttSubscriber : MqttCallbackExtended {
|
||||
println("topic: $topic")
|
||||
benchValues.put(topic.split("/")[1].toInt(),Instant.now())
|
||||
println("message: " + String(message.payload))
|
||||
|
||||
}
|
||||
|
||||
override fun connectComplete(reconnect: Boolean, serverURI: String?) {
|
||||
|
Reference in New Issue
Block a user