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 f390cf3fc2..eed3f82bc7 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 @@ -56,11 +56,10 @@ public class MQTTEventAdapter implements InputEventAdapter { mqttBrokerConnectionConfiguration = new MQTTBrokerConnectionConfiguration(eventAdapterConfiguration ,globalProperties); String topic = eventAdapterConfiguration.getProperties().get(MQTTEventAdapterConstants.ADAPTER_MESSAGE_TOPIC); - String tenantDomain = topic.split("/")[0]; mqttAdapterListener = new MQTTAdapterListener(mqttBrokerConnectionConfiguration ,topic ,eventAdapterConfiguration - ,eventAdapterListener, tenantDomain); + ,eventAdapterListener); } catch (Throwable t) { throw new InputEventAdapterException(t.getMessage(), t); } 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 f9d62482e9..f7ea4d2547 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 @@ -76,7 +76,7 @@ public class MQTTAdapterListener implements MqttCallback, Runnable { public MQTTAdapterListener(MQTTBrokerConnectionConfiguration mqttBrokerConnectionConfiguration, String topic, InputEventAdapterConfiguration inputEventAdapterConfiguration, - InputEventAdapterListener inputEventAdapterListener, String tenantDomain) { + InputEventAdapterListener inputEventAdapterListener) { String mqttClientId = inputEventAdapterConfiguration.getProperties() .get(MQTTEventAdapterConstants.ADAPTER_CONF_CLIENTID); if(mqttClientId == null || mqttClientId.trim().isEmpty()){ @@ -88,7 +88,7 @@ public class MQTTAdapterListener implements MqttCallback, Runnable { int keepAlive = mqttBrokerConnectionConfiguration.getKeepAlive(); this.topic = PropertyUtils.replaceTenantDomainProperty(topic); this.eventAdapterListener = inputEventAdapterListener; - this.tenantDomain = PropertyUtils.replaceTenantDomainProperty(tenantDomain); + this.tenantDomain = this.topic.split("/")[0]; //SORTING messages until the server fetches them String temp_directory = System.getProperty("java.io.tmpdir");