[ 
https://issues.apache.org/jira/browse/ARTEMIS-1235?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16059157#comment-16059157
 ] 

ASF GitHub Bot commented on ARTEMIS-1235:
-----------------------------------------

Github user mtaylor commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1345#discussion_r123480175
  
    --- 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<String> addressesInConfig = 
configuration.getAddressConfigurations().stream()
    +                                                   
.map(CoreAddressConfiguration::getName)
    +                                                   
.collect(Collectors.toSet());
    +
    +      Set<String> 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 --
    
    FORCE mean FORCE.  Brexit means Brexit.  What ever that means.
    
    @clebertsuconic I think @michaelandrepearce code is correct.  We **do** 
want to delete subscription queues if an address is removed.  Any auto-created 
queues should be deleted if the address is removed from the configuration.  
This may result in client exceptions and/or lost messages, but these are 
desired consequences of the behaviour.  We can add other policies later, like 
@michaelandrepearce we could add a "SAFE_DELETE" or "ON_QUEUES" policy (what 
ever we want to call it) that will attempt the deletion of the address, but 
won't if there are queues associated with it.  But, as I already mentioned, we 
could second guess what users actually want all day long.  Let's just implement 
the two basic policies FORCE (what @michaelandrepearce requires) and OFF 
(current behaviour).  We can do SAFE_DELETE etc... when requirements crop up.
    
    @clebertsuconic Unless there's something I am missing that isn't explained 
here?



> 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)

Reply via email to