From ea2ef7e25b1a3145f989a1ff7fa5f4a5c7aebba6 Mon Sep 17 00:00:00 2001 From: J-N-K Date: Wed, 11 Dec 2019 08:51:18 +0100 Subject: [PATCH] fix failing subscriptions (#1267) Signed-off-by: Jan N. Klug --- .../mqtt/internal/client/MqttAsyncClientWrapper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/eclipse/smarthome/io/transport/mqtt/internal/client/MqttAsyncClientWrapper.java b/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/eclipse/smarthome/io/transport/mqtt/internal/client/MqttAsyncClientWrapper.java index 3729014bd..e711d1d31 100644 --- a/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/eclipse/smarthome/io/transport/mqtt/internal/client/MqttAsyncClientWrapper.java +++ b/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/eclipse/smarthome/io/transport/mqtt/internal/client/MqttAsyncClientWrapper.java @@ -35,7 +35,7 @@ import org.slf4j.LoggerFactory; @NonNullByDefault public abstract class MqttAsyncClientWrapper { private final Logger logger = LoggerFactory.getLogger(MqttAsyncClientWrapper.class); - private final Set subscriptions = ConcurrentHashMap.newKeySet(); + private final Set subscriptions = ConcurrentHashMap.newKeySet(); /** * connect this client @@ -72,7 +72,7 @@ public abstract class MqttAsyncClientWrapper { * @return a CompletableFuture (exceptionally on fail) */ public CompletableFuture subscribe(String topic, int qos, ClientCallback clientCallback) { - boolean needsSubscription = subscriptions.add(clientCallback); + boolean needsSubscription = subscriptions.add(topic); if (needsSubscription) { logger.trace("Trying to subscribe {} to topic {}", this, topic); return internalSubscribe(topic, qos, clientCallback).thenApply(s -> {