diff --git a/components/device-mgt-iot-virtualfirealarm/org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/VirtualFireAlarmService.java b/components/device-mgt-iot-virtualfirealarm/org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/VirtualFireAlarmService.java index 1ea0aca206..9631cc6f2e 100644 --- a/components/device-mgt-iot-virtualfirealarm/org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/VirtualFireAlarmService.java +++ b/components/device-mgt-iot-virtualfirealarm/org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/VirtualFireAlarmService.java @@ -147,7 +147,6 @@ public class VirtualFireAlarmService { // Runnable xmppStarter = new Runnable() { // @Override // public void run() { - virtualFireAlarmMQTTConnector.initConnector(); virtualFireAlarmMQTTConnector.connect(); // } // }; diff --git a/components/device-mgt-iot-virtualfirealarm/org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/transport/VirtualFireAlarmMQTTConnector.java b/components/device-mgt-iot-virtualfirealarm/org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/transport/VirtualFireAlarmMQTTConnector.java index d8a45678c4..49170235fc 100644 --- a/components/device-mgt-iot-virtualfirealarm/org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/transport/VirtualFireAlarmMQTTConnector.java +++ b/components/device-mgt-iot-virtualfirealarm/org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/transport/VirtualFireAlarmMQTTConnector.java @@ -43,22 +43,19 @@ import java.util.UUID; public class VirtualFireAlarmMQTTConnector extends MQTTTransportHandler { private static Log log = LogFactory.getLog(VirtualFireAlarmMQTTConnector.class); - private static String serverName; - private static String subscribeTopic; - private static String iotServerSubscriber; + private static String serverName = DeviceManagementConfigurationManager.getInstance(). + getDeviceManagementServerInfo().getName(); + + private static String subscribeTopic = serverName + File.separator + "+" + File.separator + + VirtualFireAlarmConstants.DEVICE_TYPE + File.separator + "+" + File.separator + "publisher"; + + private static String iotServerSubscriber = UUID.randomUUID().toString().substring(0, 5); private VirtualFireAlarmMQTTConnector() { super(iotServerSubscriber, VirtualFireAlarmConstants.DEVICE_TYPE, MqttConfig.getInstance().getMqttQueueEndpoint(), subscribeTopic); } - public void initConnector(){ - iotServerSubscriber = UUID.randomUUID().toString().substring(0, 5); - serverName = DeviceManagementConfigurationManager.getInstance().getDeviceManagementServerInfo().getName(); - subscribeTopic = serverName + File.separator + "+" + File.separator + VirtualFireAlarmConstants.DEVICE_TYPE + - File.separator + "+" + File.separator + "publisher"; - } - @Override public void connect() { Runnable connector = new Runnable() { diff --git a/components/device-mgt-iot/org.wso2.carbon.device.mgt.iot/src/main/java/org/wso2/carbon/device/mgt/iot/controlqueue/xmpp/XmppServerClient.java b/components/device-mgt-iot/org.wso2.carbon.device.mgt.iot/src/main/java/org/wso2/carbon/device/mgt/iot/controlqueue/xmpp/XmppServerClient.java index ca6d16fe5e..043adafdaa 100644 --- a/components/device-mgt-iot/org.wso2.carbon.device.mgt.iot/src/main/java/org/wso2/carbon/device/mgt/iot/controlqueue/xmpp/XmppServerClient.java +++ b/components/device-mgt-iot/org.wso2.carbon.device.mgt.iot/src/main/java/org/wso2/carbon/device/mgt/iot/controlqueue/xmpp/XmppServerClient.java @@ -220,7 +220,7 @@ public class XmppServerClient implements ControlQueueConnector { return true; } else { String warnMsg = "XMPP set to false in 'devicemgt-config.xml'"; - log.error(warnMsg); + log.warn(warnMsg); throw new DeviceControllerException(warnMsg); } }