This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/main by this push:
     new 20bbfe3  [ARTEMIS-3682]: No way of knowing if a bridge was 
successfully deployed or not.
20bbfe3 is described below

commit 20bbfe3afb00146466b08bc1733ddb11eaebb4dc
Author: Emmanuel Hugonnet <[email protected]>
AuthorDate: Mon Feb 14 09:08:23 2022 +0100

    [ARTEMIS-3682]: No way of knowing if a bridge was successfully deployed
    or not.
    
     * deployBridge now returns a boolean to know if the deployment
       succeeded or not.
    
    Issue: https://issues.apache.org/jira/browse/ARTEMIS-3682
---
 .../activemq/artemis/core/server/ActiveMQServer.java      |  2 +-
 .../artemis/core/server/cluster/ClusterManager.java       | 15 ++++++++-------
 .../artemis/core/server/impl/ActiveMQServerImpl.java      |  5 +++--
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
index 8bd978c..2c216ba 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
@@ -705,7 +705,7 @@ public interface ActiveMQServer extends ServiceComponent {
 
    ConnectorsService getConnectorsService();
 
-   void deployBridge(BridgeConfiguration config) throws Exception;
+   boolean deployBridge(BridgeConfiguration config) throws Exception;
 
    void destroyBridge(String name) throws Exception;
 
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java
index a617e23..da860d5 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java
@@ -378,17 +378,17 @@ public class ClusterManager implements ActiveMQComponent {
       this.clusterLocators.remove(serverLocator);
    }
 
-   public synchronized void deployBridge(final BridgeConfiguration config) 
throws Exception {
+   public synchronized boolean deployBridge(final BridgeConfiguration config) 
throws Exception {
       if (config.getName() == null) {
          ActiveMQServerLogger.LOGGER.bridgeNotUnique();
 
-         return;
+         return false;
       }
 
       if (config.getQueueName() == null) {
          ActiveMQServerLogger.LOGGER.bridgeNoQueue(config.getName());
 
-         return;
+         return false;
       }
 
       if (config.getForwardingAddress() == null) {
@@ -398,7 +398,7 @@ public class ClusterManager implements ActiveMQComponent {
       if (bridges.containsKey(config.getName())) {
          ActiveMQServerLogger.LOGGER.bridgeAlreadyDeployed(config.getName());
 
-         return;
+         return false;
       }
 
       Transformer transformer = 
server.getServiceRegistry().getBridgeTransformer(config.getName(), 
config.getTransformerConfiguration());
@@ -408,7 +408,7 @@ public class ClusterManager implements ActiveMQComponent {
       if (binding == null) {
          
ActiveMQServerLogger.LOGGER.bridgeQueueNotFound(config.getQueueName(), 
config.getName());
 
-         return;
+         return false;
       }
 
       if (server.hasBrokerBridgePlugins()) {
@@ -424,7 +424,7 @@ public class ClusterManager implements ActiveMQComponent {
          if (discoveryGroupConfiguration == null) {
             
ActiveMQServerLogger.LOGGER.bridgeNoDiscoveryGroup(config.getDiscoveryGroupName());
 
-            return;
+            return false;
          }
 
          if (config.isHA()) {
@@ -438,7 +438,7 @@ public class ClusterManager implements ActiveMQComponent {
 
          if (tcConfigs == null) {
             
ActiveMQServerLogger.LOGGER.bridgeCantFindConnectors(config.getName());
-            return;
+            return false;
          }
 
          if (config.isHA()) {
@@ -497,6 +497,7 @@ public class ClusterManager implements ActiveMQComponent {
             server.callBrokerBridgePlugins(plugin -> 
plugin.afterDeployBridge(bridge));
          }
       }
+      return true;
    }
 
    public static class IncomingInterceptorLookingForExceptionMessage 
implements Interceptor {
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
index e227f4b..0973910 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
@@ -2897,10 +2897,11 @@ public class ActiveMQServerImpl implements 
ActiveMQServer {
    }
 
    @Override
-   public void deployBridge(BridgeConfiguration config) throws Exception {
+   public boolean deployBridge(BridgeConfiguration config) throws Exception {
       if (clusterManager != null) {
-         clusterManager.deployBridge(config);
+         return clusterManager.deployBridge(config);
       }
+      return false;
    }
 
    @Override

Reply via email to