@Override public String updateQueue(String name, String routingType, String filter, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean nonDestructive, Integer consumersBeforeDispatch, Long delayBeforeDispatch, String user) throws Exception { checkStarted(); clearIO(); try { final Queue queue = server.updateQueue(name, routingType != null ? RoutingType.valueOf(routingType) : null, filter, maxConsumers, purgeOnNoConsumers, exclusive, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, user); if (queue == null) { throw ActiveMQMessageBundle.BUNDLE.noSuchQueue(new SimpleString(name)); } return QueueTextFormatter.Long.format(queue, new StringBuilder()).toString(); } finally { blockOnIO(); } }
/** * Checks to see if this destination exists. If it does not throw an invalid destination exception. * * @param destination */ private void validateDestination(ActiveMQDestination destination) throws Exception { if (destination.isQueue()) { SimpleString physicalName = new SimpleString(destination.getPhysicalName()); BindingQueryResult result = server.bindingQuery(physicalName); if (!result.isExists() && !result.isAutoCreateQueues()) { throw ActiveMQMessageBundle.BUNDLE.noSuchQueue(physicalName); } } }
@Override public void destroyQueue(final SimpleString queueName, final SecurityAuth session, final boolean checkConsumerCount, final boolean removeConsumers) throws Exception { if (postOffice == null) { return; } Binding binding = postOffice.getBinding(queueName); if (binding == null) { throw ActiveMQMessageBundle.BUNDLE.noSuchQueue(queueName); } String address = binding.getAddress().toString(); destroyQueue(queueName, session, checkConsumerCount, removeConsumers, addressSettingsRepository.getMatch(address).isAutoDeleteAddresses()); }
/** * 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.noSuchQueue(queueName);
throw ActiveMQMessageBundle.BUNDLE.noSuchQueue(unPrefixedQueueName);