michaelandrepearce commented on a change in pull request #2903: ARTEMIS-2565 - 
Add plugin support for Federated Queues/Addresses
URL: https://github.com/apache/activemq-artemis/pull/2903#discussion_r357893119
 
 

 ##########
 File path: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/federation/FederatedAbstract.java
 ##########
 @@ -104,9 +109,27 @@ public synchronized void 
createRemoteConsumer(FederatedConsumerKey key, Transfor
       if (started) {
          FederatedQueueConsumer remoteQueueConsumer = 
remoteQueueConsumers.get(key);
          if (remoteQueueConsumer == null) {
+            if (server.hasBrokerFederationPlugins()) {
+               try {
+                  server.callBrokerFederationPlugins(plugin -> 
plugin.beforeCreateFederatedQueueConsumer(key));
+               } catch (ActiveMQException t) {
+                  logger.warn("Error executing 
beforeCreateFederatedQueueConsumer plugin method: {}", t.getMessage(), t);
+                  throw new IllegalStateException(t.getMessage(), 
t.getCause());
+               }
+            }
             remoteQueueConsumer = new FederatedQueueConsumer(federation, 
server, transformer, key, upstream, callback);
             remoteQueueConsumer.start();
             remoteQueueConsumers.put(key, remoteQueueConsumer);
+
+            if (server.hasBrokerFederationPlugins()) {
+               try {
+                  final FederatedQueueConsumer finalConsumer = 
remoteQueueConsumer;
+                  server.callBrokerFederationPlugins(plugin -> 
plugin.afterCreateFederatedQueueConsumer(finalConsumer));
 
 Review comment:
   we should extract interface of FederationQueueConsumer, and make plugin use 
the interface, not concrete implementation, as this plugins will cause it to be 
a public api for end users, making any future refactoring impossible.

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