Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 62D67200CAF for ; Thu, 22 Jun 2017 13:36:28 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 6167A160BE7; Thu, 22 Jun 2017 11:36:28 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A384A160BE5 for ; Thu, 22 Jun 2017 13:36:27 +0200 (CEST) Received: (qmail 76663 invoked by uid 500); 22 Jun 2017 11:36:26 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 76642 invoked by uid 99); 22 Jun 2017 11:36:26 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Jun 2017 11:36:26 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9F30BDFB92; Thu, 22 Jun 2017 11:36:23 +0000 (UTC) From: michaelandrepearce To: dev@activemq.apache.org Reply-To: dev@activemq.apache.org References: In-Reply-To: Subject: [GitHub] activemq-artemis pull request #1345: ARTEMIS-1235 Support queue and address ... Content-Type: text/plain Message-Id: <20170622113624.9F30BDFB92@git1-us-west.apache.org> Date: Thu, 22 Jun 2017 11:36:23 +0000 (UTC) archived-at: Thu, 22 Jun 2017 11:36:28 -0000 Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1345#discussion_r123486475 --- Diff: artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java --- @@ -2313,6 +2318,53 @@ private void deploySecurityFromConfiguration() { } } + private void undeployAddressesAndQueueNotInConfiguration() throws Exception { + undeployAddressesAndQueueNotInConfiguration(configuration); + } + + private void undeployAddressesAndQueueNotInConfiguration(Configuration configuration) throws Exception { + Set addressesInConfig = configuration.getAddressConfigurations().stream() + .map(CoreAddressConfiguration::getName) + .collect(Collectors.toSet()); + + Set queuesInConfig = configuration.getAddressConfigurations().stream() + .map(CoreAddressConfiguration::getQueueConfigurations) + .flatMap(List::stream).map(CoreQueueConfiguration::getName) + .collect(Collectors.toSet()); + + for (SimpleString addressName : listAddressNames()) { + AddressSettings addressSettings = getAddressSettingsRepository().getMatch(addressName.toString()); + + if (!addressesInConfig.contains(addressName.toString()) && addressSettings.getConfigDeleteAddresses() == DeletionPolicy.FORCE) { + for (Queue queue : listQueues(addressName)) { + ActiveMQServerLogger.LOGGER.undeployQueue(queue.getName()); + queue.deleteQueue(true); + } + ActiveMQServerLogger.LOGGER.undeployAddress(addressName); + removeAddressInfo(addressName, null); + } else if (addressSettings.getConfigDeleteQueues() == DeletionPolicy.FORCE) { + for (Queue queue : listConfiguredQueues(addressName)) { + if (!queuesInConfig.contains(queue.getName().toString())) { --- End diff -- @mtaylor yes indeed this is what i was trying to convey, but you manage to express it a lot cleaner than i can. Thanks. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---