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 71334200CD3 for ; Thu, 22 Jun 2017 13:37:07 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 6C9B0160BF1; Thu, 22 Jun 2017 11:37:07 +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 8F345160BE7 for ; Thu, 22 Jun 2017 13:37:06 +0200 (CEST) Received: (qmail 78338 invoked by uid 500); 22 Jun 2017 11:37:05 -0000 Mailing-List: contact issues-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 issues@activemq.apache.org Received: (qmail 78075 invoked by uid 99); 22 Jun 2017 11:37:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Jun 2017 11:37:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 43CB7C028B for ; Thu, 22 Jun 2017 11:37:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.201 X-Spam-Level: X-Spam-Status: No, score=-99.201 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id uA2ZGwAfT8Lp for ; Thu, 22 Jun 2017 11:37:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 4C4C35F5B9 for ; Thu, 22 Jun 2017 11:37:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 7D433E0D51 for ; Thu, 22 Jun 2017 11:37:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 318AD21943 for ; Thu, 22 Jun 2017 11:37:00 +0000 (UTC) Date: Thu, 22 Jun 2017 11:37:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@activemq.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (ARTEMIS-1235) Support the ability to enable queue and address deletion when broker.xml changes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 22 Jun 2017 11:37:07 -0000 [ https://issues.apache.org/jira/browse/ARTEMIS-1235?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16059212#comment-16059212 ] ASF GitHub Bot commented on ARTEMIS-1235: ----------------------------------------- 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. > Support the ability to enable queue and address deletion when broker.xml changes > -------------------------------------------------------------------------------- > > Key: ARTEMIS-1235 > URL: https://issues.apache.org/jira/browse/ARTEMIS-1235 > Project: ActiveMQ Artemis > Issue Type: New Feature > Reporter: Michael Andre Pearce > > Currently on config reload, as per: > https://activemq.apache.org/artemis/docs/2.1.0/config-reload.html > Once the configuration file is changed (broker.xml) the following modules will be reloaded automatically: > Address Settings > Security Settings > Diverts > Addresses & queues > Notice: Address & queues won't be removed upon reload, given the risk of losing messages. You may execute explicit CLI or Management operations to remove destinations. > Where an organisation uses tools like puppet or chef and need to fully change manage the broker they need an ability to delete queues and topics also via the config, as these tools control state of systems by config. Like wise in these scenario's where such tools are used to control state of a system typically an organisation will have controls and pre-prod environments where they push config through the environments as such risk of issue is removed re data loss / or accepted risk, as would have been pre-validated in non-ciritical non-prod envs. > The default behaviour should be as is today (e.g. delete still doesn't occur), but an optional toggle so that queue's and address's are sync'd removed inline with the broker xml. > Ideally it should be possible to toggle this ability by address pattern so if some address's you don't wish controlled this way and others you do, this should be possible. -- This message was sent by Atlassian JIRA (v6.4.14#64029)