clebertsuconic commented on code in PR #4681:
URL: https://github.com/apache/activemq-artemis/pull/4681#discussion_r1525706187


##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/DivertImpl.java:
##########
@@ -136,6 +139,21 @@ public void route(final Message message, final 
RoutingContext context) throws Ex
 
             // We call reencode at the end only, in a single call.
             copy.reencode();
+
+            if 
(postOffice.getAddressSettingsMatch(copy.getAddress()).isAutoCreateDivertDestination())
 {

Review Comment:
   Instead of getAddressSettingsMatch on every message (which will actually 
have a negative perf impact for any case), you should rather check once, and 
register a listener on the HierarchicalRepositoryChangeListener.
   
   This is how actually page updates the maxPage data after anything is changed:
   
   
https://github.com/apache/activemq-artemis/blob/89c3a627e9ca2b1ef48a6411d372c32f90a6f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingManagerImpl.java#L192-L194
   
   
   you could also have such listener done on a higher level and call every 
Divert to recalculate attributes (that would be less risky of leaks, say a 
Divert being unregistered would leak on the Listener).
   
   



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to