Minor fix in MQTT adapter listner

master^2
Pasindu Rupasinghe 1 year ago
parent d7e4d7c9ac
commit 52fb25afe2

@ -136,7 +136,7 @@ public class MQTTAdapterListener implements MqttCallback, Runnable {
String applicationName = MQTTEventAdapterConstants.APPLICATION_NAME_PREFIX String applicationName = MQTTEventAdapterConstants.APPLICATION_NAME_PREFIX
+ mqttBrokerConnectionConfiguration.getAdapterName(); + mqttBrokerConnectionConfiguration.getAdapterName();
DCRResponse dcrResponse = keyMgtService.dynamicClientRegistration(applicationName, username, DCRResponse dcrResponse = keyMgtService.dynamicClientRegistration(applicationName, username,
"client_credentials", null, new String[]{"device_management"}, false, Integer.MAX_VALUE); "client_credentials", null, new String[]{"device_management"}, false, Integer.MAX_VALUE, password);
String accessToken = getToken(dcrResponse.getClientId(), dcrResponse.getClientSecret()); String accessToken = getToken(dcrResponse.getClientId(), dcrResponse.getClientSecret());
connectionOptions.setUserName(accessToken.substring(0, 18)); connectionOptions.setUserName(accessToken.substring(0, 18));
connectionOptions.setPassword(accessToken.substring(19).toCharArray()); connectionOptions.setPassword(accessToken.substring(19).toCharArray());

@ -158,7 +158,7 @@ public class MQTTAdapterPublisher {
String applicationName = MQTTEventAdapterConstants.APPLICATION_NAME_PREFIX String applicationName = MQTTEventAdapterConstants.APPLICATION_NAME_PREFIX
+ mqttBrokerConnectionConfiguration.getAdapterName(); + mqttBrokerConnectionConfiguration.getAdapterName();
DCRResponse dcrResponse = keyMgtService.dynamicClientRegistration(applicationName, username, DCRResponse dcrResponse = keyMgtService.dynamicClientRegistration(applicationName, username,
"client_credentials", null, new String[]{"device_management"}, false, Integer.MAX_VALUE); "client_credentials", null, new String[]{"device_management"}, false, Integer.MAX_VALUE, password);
return getToken(dcrResponse.getClientId(), dcrResponse.getClientSecret()); return getToken(dcrResponse.getClientId(), dcrResponse.getClientSecret());
// connectionOptions.setUserName(accessToken.substring(0, 18)); // connectionOptions.setUserName(accessToken.substring(0, 18));
// connectionOptions.setPassword(accessToken.substring(19).toCharArray()); // connectionOptions.setPassword(accessToken.substring(19).toCharArray());

Loading…
Cancel
Save