public void Publish(String subject, Object args) { assert (_eventBus != null); _eventBus.publish(_sender, subject, _scope, args); } }
private void publishOnEventBus(AsyncJob job, String jobEvent) { _messageBus.publish(null, AsyncJob.Topics.JOB_EVENT_PUBLISH, PublishScope.LOCAL, new Pair<AsyncJob, String>(job, jobEvent)); }
@Override public AffinityGroupVO doInTransaction(TransactionStatus status) { AffinityGroupVO group = new AffinityGroupVO(affinityGroupName, affinityGroupType, description, affinityGroupDomainId, owner.getId(), aclType); _affinityGroupDao.persist(group); if (aclType == ACLType.Domain) { boolean subDomainAccess = false; subDomainAccess = processor.subDomainAccess(); AffinityGroupDomainMapVO domainMap = new AffinityGroupDomainMapVO(group.getId(), affinityGroupDomainId, subDomainAccess); _affinityGroupDomainMapDao.persist(domainMap); //send event for storing the domain wide resource access Map<String, Object> params = new HashMap<String, Object>(); params.put(ApiConstants.ENTITY_TYPE, AffinityGroup.class); params.put(ApiConstants.ENTITY_ID, group.getId()); params.put(ApiConstants.DOMAIN_ID, affinityGroupDomainId); params.put(ApiConstants.SUBDOMAIN_ACCESS, subDomainAccess); _messageBus.publish(_name, EntityManager.MESSAGE_ADD_DOMAIN_WIDE_ENTITY_EVENT, PublishScope.LOCAL, params); } return group; } });
/** * Publish pre-remove and remove domain events and remove domain * @param domain domain to remove * @throws CloudRuntimeException when domain cannot be removed */ protected void publishRemoveEventsAndRemoveDomain(DomainVO domain) { _messageBus.publish(_name, MESSAGE_PRE_REMOVE_DOMAIN_EVENT, PublishScope.LOCAL, domain); if (!_domainDao.remove(domain.getId())) { CloudRuntimeException e = new CloudRuntimeException("Delete failed on domain " + domain.getName() + " (id: " + domain.getId() + "); Please make sure all users and sub domains have been removed from the domain before deleting"); e.addProxyObject(domain.getUuid(), "domainId"); throw e; } _messageBus.publish(_name, MESSAGE_REMOVE_DOMAIN_EVENT, PublishScope.LOCAL, domain); }
s_logger.debug("VM state report is updated. host: " + hostId + ", vm id: " + entry.getKey() + ", power state: " + entry.getValue()); _messageBus.publish(null, VirtualMachineManager.Topics.VM_POWER_STATE, PublishScope.GLOBAL, entry.getKey()); } else { if (s_logger.isDebugEnabled()) s_logger.debug("VM state report is updated. host: " + hostId + ", vm id: " + instance.getId() + ", power state: PowerReportMissing "); _messageBus.publish(null, VirtualMachineManager.Topics.VM_POWER_STATE, PublishScope.GLOBAL, instance.getId()); } else { if (s_logger.isDebugEnabled())
params.put(ApiConstants.DOMAIN_ID, domainId); params.put(ApiConstants.SUBDOMAIN_ACCESS, subdomainAccessFinal == null ? Boolean.TRUE : subdomainAccessFinal); _messageBus.publish(_name, EntityManager.MESSAGE_ADD_DOMAIN_WIDE_ENTITY_EVENT, PublishScope.LOCAL, params);
_messageBus.publish(null, AsyncJob.Topics.JOB_STATE, PublishScope.GLOBAL, jobId);
public boolean applyACLItemsToNetwork(final long networkId, final List<NetworkACLItemVO> rules) throws ResourceUnavailableException { final Network network = _networkDao.findById(networkId); boolean handled = false; boolean foundProvider = false; for (final NetworkACLServiceProvider element : _networkAclElements) { final Network.Provider provider = element.getProvider(); final boolean isAclProvider = _networkModel.isProviderSupportServiceInNetwork(network.getId(), Service.NetworkACL, provider); if (!isAclProvider) { continue; } foundProvider = true; s_logger.debug("Applying NetworkACL for network: " + network.getId() + " with Network ACL service provider"); handled = element.applyNetworkACLs(network, rules); if (handled) { // publish message on message bus, so that network elements implementing distributed routing // capability can act on the event _messageBus.publish(_name, "Network_ACL_Replaced", PublishScope.LOCAL, network); break; } } if (!foundProvider) { s_logger.debug("Unable to find NetworkACL service provider for network: " + network.getId()); } return handled; }
@Override @DB @ActionEvent(eventType = EventTypes.EVENT_AFFINITY_GROUP_DELETE, eventDescription = "Deleting affinity group") public boolean deleteAffinityGroup(Long affinityGroupId, String account, Long projectId, Long domainId, String affinityGroupName) { AffinityGroupVO group = getAffinityGroup(affinityGroupId, account, projectId, domainId, affinityGroupName); // check permissions Account caller = CallContext.current().getCallingAccount(); _accountMgr.checkAccess(caller, AccessType.OperateEntry, true, group); final Long affinityGroupIdFinal = group.getId(); deleteAffinityGroup(affinityGroupIdFinal); // remove its related ACL permission Pair<Class<?>, Long> params = new Pair<Class<?>, Long>(AffinityGroup.class, affinityGroupIdFinal); _messageBus.publish(_name, EntityManager.MESSAGE_REMOVE_ENTITY_EVENT, PublishScope.LOCAL, params); if (s_logger.isDebugEnabled()) { s_logger.debug("Deleted affinity group id=" + affinityGroupIdFinal); } return true; }
_messageBus.publish(_name, MESSAGE_ADD_DOMAIN_EVENT, PublishScope.LOCAL, domain.getId());
_messageBus.publish(_name, EntityManager.MESSAGE_REMOVE_ENTITY_EVENT, PublishScope.LOCAL, networkMsg);
permit.put(ApiConstants.ACCESS_TYPE, AccessType.UseEntry); permit.put(ApiConstants.ACCOUNTS, accountIds); _messageBus.publish(_name, EntityManager.MESSAGE_GRANT_ENTITY_EVENT, PublishScope.LOCAL, permit); } else if ("remove".equalsIgnoreCase(operation)) { List<Long> accountIds = new ArrayList<Long>(); permit.put(ApiConstants.ACCESS_TYPE, AccessType.UseEntry); permit.put(ApiConstants.ACCOUNTS, accountIds); _messageBus.publish(_name, EntityManager.MESSAGE_REVOKE_ENTITY_EVENT, PublishScope.LOCAL, permit); } else if ("reset".equalsIgnoreCase(operation)) { _tmpltDao.update(template.getId(), updatedTemplate); _launchPermissionDao.removeAllPermissions(id); _messageBus.publish(_name, TemplateManager.MESSAGE_RESET_TEMPLATE_PERMISSION_EVENT, PublishScope.LOCAL, template.getId());
Map<Long, Long> accountGroupMap = new HashMap<Long, Long>(); accountGroupMap.put(account.getId(), new Long(accountType + 1)); _messageBus.publish(_name, MESSAGE_ADD_ACCOUNT_EVENT, PublishScope.LOCAL, accountGroupMap);
messageBus.publish(_name, EventTypes.EVENT_CONFIGURATION_VALUE_EDIT, PublishScope.GLOBAL, name); return _configDao.getValue(name);
_messageBus.publish(_name, "Network_ACL_Replaced", PublishScope.LOCAL, network);
_messageBus.publish(_name, "VM_ReservedCapacity_Free", PublishScope.LOCAL, vm);
_messageBus.publish(null, TemplateManager.MESSAGE_REGISTER_PUBLIC_TEMPLATE_EVENT, PublishScope.LOCAL, tmplt.getId());
_messageBus.publish(_name, EntityManager.MESSAGE_REMOVE_ENTITY_EVENT, PublishScope.LOCAL, tmplt);
_messageBus.publish(_name, TemplateManager.MESSAGE_REGISTER_PUBLIC_TEMPLATE_EVENT, PublishScope.LOCAL, tmplt.getId());