api: Fix issue observed with message publish on creation of domain (#6118)

* api: Fix issue observed with message publish on creation of domain

* add check for successful creation of domain  before publishing event
This commit is contained in:
Pearl Dsilva 2022-03-16 12:25:36 +05:30 committed by GitHub
parent 56bf418185
commit ca9e28dc84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -220,11 +220,12 @@ public class DomainManagerImpl extends ManagerBase implements DomainManager, Dom
_resourceCountDao.createResourceCounts(domain.getId(), ResourceLimit.ResourceOwnerType.Domain);
CallContext.current().putContextParameter(Domain.class, domain.getUuid());
_messageBus.publish(_name, MESSAGE_ADD_DOMAIN_EVENT, PublishScope.LOCAL, domain.getId());
return domain;
}
});
if (domain != null) {
_messageBus.publish(_name, MESSAGE_ADD_DOMAIN_EVENT, PublishScope.LOCAL, domain.getId());
}
return domain;
}