From 10f75d5f733fbb5b422419280dee57443d123f51 Mon Sep 17 00:00:00 2001 From: ayyoob Date: Thu, 12 May 2016 09:06:11 +0530 Subject: [PATCH] refactored topic structure --- .../android/sense/data/publisher/DataPublisherService.java | 2 +- .../data/publisher/mqtt/transport/MQTTTransportHandler.java | 2 +- .../device/mgt/iot/raspberrypi/service/impl/util/ZipUtil.java | 2 +- .../src/main/resources/agent/deviceConfig.properties | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/DataPublisherService.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/DataPublisherService.java index 8840adf70..a95f94767 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/DataPublisherService.java +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/DataPublisherService.java @@ -162,7 +162,7 @@ public class DataPublisherService extends Service { if (!mqttTransportHandler.isConnected()) { mqttTransportHandler.connect(); } - String topic = "wso2/" + LocalRegistry.getTenantDomain(context) + "/" + SenseConstants + String topic = LocalRegistry.getTenantDomain(context) + "/" + SenseConstants .DEVICE_TYPE + "/" + deviceId + "/data"; mqttTransportHandler.publishDeviceData(user, deviceId, jsonArray.toString(), topic); } diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/mqtt/transport/MQTTTransportHandler.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/mqtt/transport/MQTTTransportHandler.java index c2bd4b5d2..17884381c 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/mqtt/transport/MQTTTransportHandler.java +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.agent/app/src/main/java/org/wso2/carbon/iot/android/sense/data/publisher/mqtt/transport/MQTTTransportHandler.java @@ -77,7 +77,7 @@ public abstract class MQTTTransportHandler implements MqttCallback, TransportHan String username = LocalRegistry.getUsername(context); String deviceId = LocalRegistry.getDeviceId(context); this.clientId = deviceId + ":" + SenseConstants.DEVICE_TYPE; - this.subscribeTopic = "wso2/" + LocalRegistry.getTenantDomain(context)+ "/" + SenseConstants.DEVICE_TYPE + "/" + + this.subscribeTopic = LocalRegistry.getTenantDomain(context)+ "/" + SenseConstants.DEVICE_TYPE + "/" + deviceId + "/command/#"; this.clientWillTopic = DISCONNECTION_WILL_TOPIC_PREFIX + SenseConstants.DEVICE_TYPE; this.mqttBrokerEndPoint = LocalRegistry.getMqttEndpoint(context); diff --git a/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/util/ZipUtil.java b/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/util/ZipUtil.java index daff8d058..2b5758816 100644 --- a/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/util/ZipUtil.java +++ b/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/util/ZipUtil.java @@ -73,7 +73,7 @@ public class ZipUtil { xmppEndpoint = xmppEndpoint + ":" + XmppConfig.getInstance().getSERVER_CONNECTION_PORT(); Map contextParams = new HashMap<>(); - contextParams.put("SERVER_NAME", "wso2/" + APIUtil.getTenantDomainOftheUser()); + contextParams.put("SERVER_NAME", APIUtil.getTenantDomainOftheUser()); contextParams.put("DEVICE_OWNER", owner); contextParams.put("DEVICE_ID", deviceId); contextParams.put("DEVICE_NAME", deviceName); diff --git a/features/iot-plugins-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/deviceConfig.properties b/features/iot-plugins-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/deviceConfig.properties index 06de853d8..133429198 100644 --- a/features/iot-plugins-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/deviceConfig.properties +++ b/features/iot-plugins-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/deviceConfig.properties @@ -20,8 +20,8 @@ owner=${DEVICE_OWNER} deviceId=${DEVICE_ID} device-name=${DEVICE_NAME} controller-context=/raspberrypi/controller -mqtt-sub-topic=wso2/{owner}/raspberrypi/{deviceId} -mqtt-pub-topic=wso2/{owner}/raspberrypi/{deviceId}/publisher +mqtt-sub-topic=${SERVER_NAME}/{owner}/raspberrypi/{deviceId} +mqtt-pub-topic=${SERVER_NAME}/{owner}/raspberrypi/{deviceId}/publisher https-ep=${HTTPS_EP} http-ep=${HTTP_EP} apim-ep=${APIM_EP}