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?



---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to