mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
fixed issues in mqtt input adapter and thrift adapter after testing with multitenancy
This commit is contained in:
parent
1b4de09d7b
commit
aaeac03cfb
@ -206,8 +206,14 @@ public class MQTTAdapterListener implements MqttCallback, Runnable {
|
||||
}
|
||||
try {
|
||||
mqttClient.subscribe(topic);
|
||||
log.info("mqtt receiver subscribed to topic: " + topic);
|
||||
} catch (MqttException e) {
|
||||
log.error("Failed to subscribe to topic: " + topic + ", Retrying.....");
|
||||
try {
|
||||
mqttClient.disconnect();
|
||||
} catch (MqttException ex) {
|
||||
// do nothing.
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -137,7 +137,7 @@ public class ThriftEventAdapterServiceComponent {
|
||||
String tenantDomain = credentials.getDomainName();
|
||||
if (objects != null && objects.length > 0) {
|
||||
if (tenantDomain.equals(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME)) {
|
||||
String[] splitValues = ((String) objects[0]).split("@@");
|
||||
String[] splitValues = ((String) objects[0]).split("@");
|
||||
if (splitValues.length > 1) {
|
||||
tenantDomain = splitValues[0];
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ public class DeviceAccessBasedMQTTAuthorizer implements IAuthorizer {
|
||||
|
||||
private static final String UI_EXECUTE = "ui.execute";
|
||||
private static Log log = LogFactory.getLog(DeviceAccessBasedMQTTAuthorizer.class);
|
||||
AuthorizationConfigurationManager MQTTAuthorizationConfiguration;
|
||||
private AuthorizationConfigurationManager MQTTAuthorizationConfiguration;
|
||||
private static final String CDMF_SERVER_BASE_CONTEXT = "/api/device-mgt/v1.0";
|
||||
private static final String CACHE_MANAGER_NAME = "mqttAuthorizationCacheManager";
|
||||
private static final String CACHE_NAME = "mqttAuthorizationCache";
|
||||
@ -173,17 +173,15 @@ public class DeviceAccessBasedMQTTAuthorizer implements IAuthorizer {
|
||||
} catch (FeignException e) {
|
||||
oAuthRequestInterceptor.resetApiApplicationKey();
|
||||
if (e.getMessage().contains(GATEWAY_ERROR_CODE)) {
|
||||
log.error("Failed to connect to the device authorization service.");
|
||||
log.error("Failed to connect to the device authorization service.", e);
|
||||
} else {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
return false;
|
||||
} finally {
|
||||
PrivilegedCarbonContext.endTenantFlow();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user