diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/MQTTEventAdapter.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/MQTTEventAdapter.java index af5cb0c283..f390cf3fc2 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/MQTTEventAdapter.java +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/MQTTEventAdapter.java @@ -57,10 +57,6 @@ public class MQTTEventAdapter implements InputEventAdapter { ,globalProperties); String topic = eventAdapterConfiguration.getProperties().get(MQTTEventAdapterConstants.ADAPTER_MESSAGE_TOPIC); String tenantDomain = topic.split("/")[0]; - if (tenantDomain.equals("${tenant-domain}")) { - tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); - topic = topic.replaceAll("\\$\\{tenant-domain\\}", tenantDomain); - } mqttAdapterListener = new MQTTAdapterListener(mqttBrokerConnectionConfiguration ,topic ,eventAdapterConfiguration diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTAdapterListener.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTAdapterListener.java index 182b5c9a06..f9d62482e9 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTAdapterListener.java +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTAdapterListener.java @@ -88,7 +88,7 @@ public class MQTTAdapterListener implements MqttCallback, Runnable { int keepAlive = mqttBrokerConnectionConfiguration.getKeepAlive(); this.topic = PropertyUtils.replaceTenantDomainProperty(topic); this.eventAdapterListener = inputEventAdapterListener; - this.tenantDomain = tenantDomain; + this.tenantDomain = PropertyUtils.replaceTenantDomainProperty(tenantDomain); //SORTING messages until the server fetches them String temp_directory = System.getProperty("java.io.tmpdir");