if(!TenantManager.getInstance().isInitialized()) {
return false;
}
// Parse complete message and build event
TenantUnSubscribedEvent event = (TenantUnSubscribedEvent) Util.jsonToObject(message, TenantUnSubscribedEvent.class);
try {
TenantManager.acquireWriteLock();
Tenant tenant = TenantManager.getInstance().getTenant(event.getTenantId());
if(tenant == null) {
if(log.isWarnEnabled()) {
log.warn(String.format("Tenant not found: [tenant-id] %d", event.getTenantId()));
}
return false;
}
tenant.removeServiceSubscription(event.getServiceName());
if(log.isInfoEnabled()) {
log.info(String.format("Tenant un-subscribed from service: [tenant-id] %d [tenant-domain] %s [service] %s",
tenant.getTenantId(), tenant.getTenantDomain(), event.getServiceName()));
}
// Notify event listeners
notifyEventListeners(event);
return true;