[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
This commit is contained in:
Emmanuel Hugonnet 2022-02-14 09:08:23 +01:00 committed by clebertsuconic
parent 0bc7bf3f7c
commit 20bbfe3afb
3 changed files with 12 additions and 10 deletions

View File

@ -705,7 +705,7 @@ public interface ActiveMQServer extends ServiceComponent {
ConnectorsService getConnectorsService(); ConnectorsService getConnectorsService();
void deployBridge(BridgeConfiguration config) throws Exception; boolean deployBridge(BridgeConfiguration config) throws Exception;
void destroyBridge(String name) throws Exception; void destroyBridge(String name) throws Exception;

View File

@ -378,17 +378,17 @@ public class ClusterManager implements ActiveMQComponent {
this.clusterLocators.remove(serverLocator); 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) { if (config.getName() == null) {
ActiveMQServerLogger.LOGGER.bridgeNotUnique(); ActiveMQServerLogger.LOGGER.bridgeNotUnique();
return; return false;
} }
if (config.getQueueName() == null) { if (config.getQueueName() == null) {
ActiveMQServerLogger.LOGGER.bridgeNoQueue(config.getName()); ActiveMQServerLogger.LOGGER.bridgeNoQueue(config.getName());
return; return false;
} }
if (config.getForwardingAddress() == null) { if (config.getForwardingAddress() == null) {
@ -398,7 +398,7 @@ public class ClusterManager implements ActiveMQComponent {
if (bridges.containsKey(config.getName())) { if (bridges.containsKey(config.getName())) {
ActiveMQServerLogger.LOGGER.bridgeAlreadyDeployed(config.getName()); ActiveMQServerLogger.LOGGER.bridgeAlreadyDeployed(config.getName());
return; return false;
} }
Transformer transformer = server.getServiceRegistry().getBridgeTransformer(config.getName(), config.getTransformerConfiguration()); Transformer transformer = server.getServiceRegistry().getBridgeTransformer(config.getName(), config.getTransformerConfiguration());
@ -408,7 +408,7 @@ public class ClusterManager implements ActiveMQComponent {
if (binding == null) { if (binding == null) {
ActiveMQServerLogger.LOGGER.bridgeQueueNotFound(config.getQueueName(), config.getName()); ActiveMQServerLogger.LOGGER.bridgeQueueNotFound(config.getQueueName(), config.getName());
return; return false;
} }
if (server.hasBrokerBridgePlugins()) { if (server.hasBrokerBridgePlugins()) {
@ -424,7 +424,7 @@ public class ClusterManager implements ActiveMQComponent {
if (discoveryGroupConfiguration == null) { if (discoveryGroupConfiguration == null) {
ActiveMQServerLogger.LOGGER.bridgeNoDiscoveryGroup(config.getDiscoveryGroupName()); ActiveMQServerLogger.LOGGER.bridgeNoDiscoveryGroup(config.getDiscoveryGroupName());
return; return false;
} }
if (config.isHA()) { if (config.isHA()) {
@ -438,7 +438,7 @@ public class ClusterManager implements ActiveMQComponent {
if (tcConfigs == null) { if (tcConfigs == null) {
ActiveMQServerLogger.LOGGER.bridgeCantFindConnectors(config.getName()); ActiveMQServerLogger.LOGGER.bridgeCantFindConnectors(config.getName());
return; return false;
} }
if (config.isHA()) { if (config.isHA()) {
@ -497,6 +497,7 @@ public class ClusterManager implements ActiveMQComponent {
server.callBrokerBridgePlugins(plugin -> plugin.afterDeployBridge(bridge)); server.callBrokerBridgePlugins(plugin -> plugin.afterDeployBridge(bridge));
} }
} }
return true;
} }
public static class IncomingInterceptorLookingForExceptionMessage implements Interceptor { public static class IncomingInterceptorLookingForExceptionMessage implements Interceptor {

View File

@ -2897,10 +2897,11 @@ public class ActiveMQServerImpl implements ActiveMQServer {
} }
@Override @Override
public void deployBridge(BridgeConfiguration config) throws Exception { public boolean deployBridge(BridgeConfiguration config) throws Exception {
if (clusterManager != null) { if (clusterManager != null) {
clusterManager.deployBridge(config); return clusterManager.deployBridge(config);
} }
return false;
} }
@Override @Override