michaelandrepearce commented on a change in pull request #2850: ARTEMIS-2504 
implement retroactive addresses
URL: https://github.com/apache/activemq-artemis/pull/2850#discussion_r328402189
 
 

 ##########
 File path: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
 ##########
 @@ -467,6 +478,83 @@ private boolean internalAddressInfo(AddressInfo 
addressInfo, boolean reload) thr
       }
    }
 
+   private void registerRepositoryListenerForRetroactiveAddress(SimpleString 
name) {
+      HierarchicalRepositoryChangeListener repositoryChangeListener = () -> {
+         String prefix = server.getConfiguration().getInternalNamingPrefix();
+         String address = 
ResourceNames.decomposeRetroactiveResourceName(prefix, name.toString(), 
ResourceNames.ADDRESS);
+         AddressSettings settings = 
addressSettingsRepository.getMatch(address);
+         Queue internalQueue = 
server.locateQueue(ResourceNames.getRetroactiveResourceName(prefix, 
SimpleString.toSimpleString(address), ResourceNames.QUEUE));
+         if (internalQueue != null && internalQueue.getRingSize() != 
settings.getRetroactiveMessageCount()) {
+            internalQueue.setRingSize(settings.getRetroactiveMessageCount());
+         }
+      };
+      addressSettingsRepository.registerListener(repositoryChangeListener);
+      
server.getAddressInfo(name).setRepositoryChangeListener(repositoryChangeListener);
+   }
+
+   private void createRetroactiveResources(final SimpleString 
retroactiveAddressName, final long retroactiveMessageCount, final boolean 
reload) throws Exception {
+      String prefix = server.getConfiguration().getInternalNamingPrefix();
+      final SimpleString internalAddressName = 
ResourceNames.getRetroactiveResourceName(prefix, retroactiveAddressName, 
ResourceNames.ADDRESS);
+      final SimpleString internalQueueName = 
ResourceNames.getRetroactiveResourceName(prefix, retroactiveAddressName, 
ResourceNames.QUEUE);
+      final SimpleString internalDivertName = 
ResourceNames.getRetroactiveResourceName(prefix, retroactiveAddressName, 
ResourceNames.DIVERT);
+
+      if (!reload) {
+         AddressInfo addressInfo = new 
AddressInfo(internalAddressName).addRoutingType(RoutingType.ANYCAST).setInternal(true);
+         addAddressInfo(addressInfo);
+         server.createQueue(internalAddressName,
+                            RoutingType.ANYCAST,
 
 Review comment:
   Should message groups be disabled? So theyre not tracked as not needed in 
the retro queue and would avoid issues if people have very large numbers of 
groups.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to