refactored topic structure

revert-dabc3590
ayyoob 9 years ago
parent d53942eeaa
commit 10f75d5f73

@ -162,7 +162,7 @@ public class DataPublisherService extends Service {
if (!mqttTransportHandler.isConnected()) { if (!mqttTransportHandler.isConnected()) {
mqttTransportHandler.connect(); mqttTransportHandler.connect();
} }
String topic = "wso2/" + LocalRegistry.getTenantDomain(context) + "/" + SenseConstants String topic = LocalRegistry.getTenantDomain(context) + "/" + SenseConstants
.DEVICE_TYPE + "/" + deviceId + "/data"; .DEVICE_TYPE + "/" + deviceId + "/data";
mqttTransportHandler.publishDeviceData(user, deviceId, jsonArray.toString(), topic); mqttTransportHandler.publishDeviceData(user, deviceId, jsonArray.toString(), topic);
} }

@ -77,7 +77,7 @@ public abstract class MQTTTransportHandler implements MqttCallback, TransportHan
String username = LocalRegistry.getUsername(context); String username = LocalRegistry.getUsername(context);
String deviceId = LocalRegistry.getDeviceId(context); String deviceId = LocalRegistry.getDeviceId(context);
this.clientId = deviceId + ":" + SenseConstants.DEVICE_TYPE; 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/#"; deviceId + "/command/#";
this.clientWillTopic = DISCONNECTION_WILL_TOPIC_PREFIX + SenseConstants.DEVICE_TYPE; this.clientWillTopic = DISCONNECTION_WILL_TOPIC_PREFIX + SenseConstants.DEVICE_TYPE;
this.mqttBrokerEndPoint = LocalRegistry.getMqttEndpoint(context); this.mqttBrokerEndPoint = LocalRegistry.getMqttEndpoint(context);

@ -73,7 +73,7 @@ public class ZipUtil {
xmppEndpoint = xmppEndpoint + ":" + XmppConfig.getInstance().getSERVER_CONNECTION_PORT(); xmppEndpoint = xmppEndpoint + ":" + XmppConfig.getInstance().getSERVER_CONNECTION_PORT();
Map<String, String> contextParams = new HashMap<>(); Map<String, String> contextParams = new HashMap<>();
contextParams.put("SERVER_NAME", "wso2/" + APIUtil.getTenantDomainOftheUser()); contextParams.put("SERVER_NAME", APIUtil.getTenantDomainOftheUser());
contextParams.put("DEVICE_OWNER", owner); contextParams.put("DEVICE_OWNER", owner);
contextParams.put("DEVICE_ID", deviceId); contextParams.put("DEVICE_ID", deviceId);
contextParams.put("DEVICE_NAME", deviceName); contextParams.put("DEVICE_NAME", deviceName);

@ -20,8 +20,8 @@ owner=${DEVICE_OWNER}
deviceId=${DEVICE_ID} deviceId=${DEVICE_ID}
device-name=${DEVICE_NAME} device-name=${DEVICE_NAME}
controller-context=/raspberrypi/controller controller-context=/raspberrypi/controller
mqtt-sub-topic=wso2/{owner}/raspberrypi/{deviceId} mqtt-sub-topic=${SERVER_NAME}/{owner}/raspberrypi/{deviceId}
mqtt-pub-topic=wso2/{owner}/raspberrypi/{deviceId}/publisher mqtt-pub-topic=${SERVER_NAME}/{owner}/raspberrypi/{deviceId}/publisher
https-ep=${HTTPS_EP} https-ep=${HTTPS_EP}
http-ep=${HTTP_EP} http-ep=${HTTP_EP}
apim-ep=${APIM_EP} apim-ep=${APIM_EP}

Loading…
Cancel
Save