Fixes to the VirtualFireAlarmMQTTConnector

Shabirmean 9 years ago
parent 23fc39c60a
commit 5f8751cd95

@ -147,7 +147,6 @@ public class VirtualFireAlarmService {
// Runnable xmppStarter = new Runnable() { // Runnable xmppStarter = new Runnable() {
// @Override // @Override
// public void run() { // public void run() {
virtualFireAlarmMQTTConnector.initConnector();
virtualFireAlarmMQTTConnector.connect(); virtualFireAlarmMQTTConnector.connect();
// } // }
// }; // };

@ -43,22 +43,19 @@ import java.util.UUID;
public class VirtualFireAlarmMQTTConnector extends MQTTTransportHandler { public class VirtualFireAlarmMQTTConnector extends MQTTTransportHandler {
private static Log log = LogFactory.getLog(VirtualFireAlarmMQTTConnector.class); private static Log log = LogFactory.getLog(VirtualFireAlarmMQTTConnector.class);
private static String serverName; private static String serverName = DeviceManagementConfigurationManager.getInstance().
private static String subscribeTopic; getDeviceManagementServerInfo().getName();
private static String iotServerSubscriber;
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() { private VirtualFireAlarmMQTTConnector() {
super(iotServerSubscriber, VirtualFireAlarmConstants.DEVICE_TYPE, super(iotServerSubscriber, VirtualFireAlarmConstants.DEVICE_TYPE,
MqttConfig.getInstance().getMqttQueueEndpoint(), subscribeTopic); 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 @Override
public void connect() { public void connect() {
Runnable connector = new Runnable() { Runnable connector = new Runnable() {

@ -220,7 +220,7 @@ public class XmppServerClient implements ControlQueueConnector {
return true; return true;
} else { } else {
String warnMsg = "XMPP <Enabled> set to false in 'devicemgt-config.xml'"; String warnMsg = "XMPP <Enabled> set to false in 'devicemgt-config.xml'";
log.error(warnMsg); log.warn(warnMsg);
throw new DeviceControllerException(warnMsg); throw new DeviceControllerException(warnMsg);
} }
} }

Loading…
Cancel
Save