From 20bbfe3afb00146466b08bc1733ddb11eaebb4dc Mon Sep 17 00:00:00 2001 From: Emmanuel Hugonnet Date: Mon, 14 Feb 2022 09:08:23 +0100 Subject: [PATCH] [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 --- .../artemis/core/server/ActiveMQServer.java | 2 +- .../core/server/cluster/ClusterManager.java | 15 ++++++++------- .../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 8bd978c9e3..2c216baa30 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 a617e23262..da860d59fb 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 e227f4bd2a..0973910e10 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