@Override public String getAddressInfo(String address) throws ActiveMQAddressDoesNotExistException { checkStarted(); clearIO(); try { final AddressInfo addressInfo = server.getAddressInfo(SimpleString.toSimpleString(address)); if (addressInfo == null) { throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(SimpleString.toSimpleString(address)); } else { return AddressInfoTextFormatter.Long.format(addressInfo, new StringBuilder()).toString(); } } finally { blockOnIO(); } }
@Override public String updateAddress(String name, String routingTypes) throws Exception { checkStarted(); clearIO(); try { final EnumSet<RoutingType> routingTypeSet; if (routingTypes == null) { routingTypeSet = null; } else { routingTypeSet = EnumSet.noneOf(RoutingType.class); final String[] routingTypeNames = routingTypes.split(","); for (String routingTypeName : routingTypeNames) { routingTypeSet.add(RoutingType.valueOf(routingTypeName)); } } if (!server.updateAddressInfo(SimpleString.toSimpleString(name), routingTypeSet)) { throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(SimpleString.toSimpleString(name)); } return AddressInfoTextFormatter.Long.format(server.getAddressInfo(SimpleString.toSimpleString(name)), new StringBuilder()).toString(); } finally { blockOnIO(); } }
@Override public void removeAddressInfo(final SimpleString address, final SecurityAuth auth, boolean force) throws Exception { if (auth != null) { securityStore.check(address, CheckType.DELETE_ADDRESS, auth); } AddressInfo addressInfo = getAddressInfo(address); if (postOffice.removeAddressInfo(address, force) == null) { throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(address); } long txID = storageManager.generateID(); storageManager.deleteAddressBinding(txID, addressInfo.getId()); storageManager.commitBindings(txID); pagingManager.deletePageStore(address); }
throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(realAddressName);
/** * Creates a Queue if it doesn't already exist, based on a topic and address. Returning the queue name. */ private Queue createQueueForSubscription(String address, int qos) throws Exception { // Check to see if a subscription queue already exists. SimpleString queue = getQueueNameForTopic(address); Queue q = session.getServer().locateQueue(queue); // The queue does not exist so we need to create it. if (q == null) { SimpleString sAddress = SimpleString.toSimpleString(address); // Check we can auto create queues. BindingQueryResult bindingQueryResult = session.getServerSession().executeBindingQuery(sAddress); if (!bindingQueryResult.isAutoCreateQueues()) { throw ActiveMQMessageBundle.BUNDLE.noSuchQueue(sAddress); } // Check that the address exists, if not we try to auto create it. AddressInfo addressInfo = session.getServerSession().getAddress(sAddress); if (addressInfo == null) { if (!bindingQueryResult.isAutoCreateAddresses()) { throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(SimpleString.toSimpleString(address)); } addressInfo = session.getServerSession().createAddress(SimpleString.toSimpleString(address), RoutingType.MULTICAST, true); } return findOrCreateQueue(bindingQueryResult, addressInfo, queue, qos); } return q; }
/** * Creates a Queue if it doesn't already exist, based on a topic and address. Returning the queue name. */ private Queue createQueueForSubscription(String address, int qos) throws Exception { // Check to see if a subscription queue already exists. SimpleString queue = getQueueNameForTopic(address); Queue q = session.getServer().locateQueue(queue); // The queue does not exist so we need to create it. if (q == null) { SimpleString sAddress = SimpleString.toSimpleString(address); // Check we can auto create queues. BindingQueryResult bindingQueryResult = session.getServerSession().executeBindingQuery(sAddress); if (!bindingQueryResult.isAutoCreateQueues()) { throw ActiveMQMessageBundle.BUNDLE.noSuchQueue(sAddress); } // Check that the address exists, if not we try to auto create it. AddressInfo addressInfo = session.getServerSession().getAddress(sAddress); if (addressInfo == null) { if (!bindingQueryResult.isAutoCreateAddresses()) { throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(SimpleString.toSimpleString(address)); } addressInfo = session.getServerSession().createAddress(SimpleString.toSimpleString(address), RoutingType.MULTICAST, true); } return findOrCreateQueue(bindingQueryResult, addressInfo, queue, qos); } return q; }
throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(addressToUse); } else if (!info.getRoutingTypes().contains(rt)) { throw ActiveMQMessageBundle.BUNDLE.invalidRoutingTypeForAddress(rt, info.getName().toString(), info.getRoutingTypes());