From 37384a1ad1d0aa4b76d011ccebef468c08a401c2 Mon Sep 17 00:00:00 2001 From: Bosanac Dejan Date: Wed, 15 Jun 2011 13:18:42 +0000 Subject: [PATCH] https://issues.apache.org/jira/browse/AMQ-3135 - add remoteIp to network bridge advisory git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1136026 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/activemq/advisory/AdvisoryBroker.java | 3 ++- .../src/main/java/org/apache/activemq/broker/Broker.java | 2 +- .../main/java/org/apache/activemq/broker/BrokerFilter.java | 4 ++-- .../src/main/java/org/apache/activemq/broker/EmptyBroker.java | 2 +- .../src/main/java/org/apache/activemq/broker/ErrorBroker.java | 2 +- .../java/org/apache/activemq/broker/MutableBrokerFilter.java | 4 ++-- .../activemq/network/DemandForwardingBridgeSupport.java | 3 +-- assembly/src/sample-conf/activemq-static-network-broker2.xml | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java b/activemq-core/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java index 0b861d42f6..e1e3878391 100755 --- a/activemq-core/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java +++ b/activemq-core/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java @@ -392,12 +392,13 @@ public class AdvisoryBroker extends BrokerFilter { } @Override - public void networkBridgeStarted(BrokerInfo brokerInfo, boolean createdByDuplex) { + public void networkBridgeStarted(BrokerInfo brokerInfo, boolean createdByDuplex, String remoteIp) { try { if (brokerInfo != null) { ActiveMQMessage advisoryMessage = new ActiveMQMessage(); advisoryMessage.setBooleanProperty("started", true); advisoryMessage.setBooleanProperty("createdByDuplex", createdByDuplex); + advisoryMessage.setStringProperty("remoteIp", remoteIp); ActiveMQTopic topic = AdvisorySupport.getNetworkBridgeAdvisoryTopic(); diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/Broker.java b/activemq-core/src/main/java/org/apache/activemq/broker/Broker.java index 40a7b732a4..46861cc7a1 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/Broker.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/Broker.java @@ -382,7 +382,7 @@ public interface Broker extends Region, Service { ThreadPoolExecutor getExecutor(); - void networkBridgeStarted(BrokerInfo brokerInfo, boolean createdByDuplex); + void networkBridgeStarted(BrokerInfo brokerInfo, boolean createdByDuplex, String remoteIp); void networkBridgeStopped(BrokerInfo brokerInfo); diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFilter.java b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFilter.java index dd653902ab..ec02a936a0 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFilter.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerFilter.java @@ -312,8 +312,8 @@ public class BrokerFilter implements Broker { return next.getExecutor(); } - public void networkBridgeStarted(BrokerInfo brokerInfo, boolean createdByDuplex) { - next.networkBridgeStarted(brokerInfo, createdByDuplex); + public void networkBridgeStarted(BrokerInfo brokerInfo, boolean createdByDuplex, String remoteIp) { + next.networkBridgeStarted(brokerInfo, createdByDuplex, remoteIp); } public void networkBridgeStopped(BrokerInfo brokerInfo) { diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/EmptyBroker.java b/activemq-core/src/main/java/org/apache/activemq/broker/EmptyBroker.java index a6d693d87f..9b41a7f8bd 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/EmptyBroker.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/EmptyBroker.java @@ -284,7 +284,7 @@ public class EmptyBroker implements Broker { public void nowMasterBroker() { } - public void networkBridgeStarted(BrokerInfo brokerInfo, boolean createdByDuplex) { + public void networkBridgeStarted(BrokerInfo brokerInfo, boolean createdByDuplex, String remoteIp) { } public void networkBridgeStopped(BrokerInfo brokerInfo) { diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/ErrorBroker.java b/activemq-core/src/main/java/org/apache/activemq/broker/ErrorBroker.java index e81c88d282..c6c2b2153d 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/ErrorBroker.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/ErrorBroker.java @@ -314,7 +314,7 @@ public class ErrorBroker implements Broker { throw new BrokerStoppedException(this.message); } - public void networkBridgeStarted(BrokerInfo brokerInfo, boolean createdByDuplex) { + public void networkBridgeStarted(BrokerInfo brokerInfo, boolean createdByDuplex, String remoteIp) { throw new BrokerStoppedException(this.message); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/MutableBrokerFilter.java b/activemq-core/src/main/java/org/apache/activemq/broker/MutableBrokerFilter.java index 998f2ac88a..183d120ed5 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/MutableBrokerFilter.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/MutableBrokerFilter.java @@ -323,8 +323,8 @@ public class MutableBrokerFilter implements Broker { return getNext().getExecutor(); } - public void networkBridgeStarted(BrokerInfo brokerInfo, boolean createdByDuplex) { - getNext().networkBridgeStarted(brokerInfo, createdByDuplex); + public void networkBridgeStarted(BrokerInfo brokerInfo, boolean createdByDuplex, String remoteIp) { + getNext().networkBridgeStarted(brokerInfo, createdByDuplex, remoteIp); } public void networkBridgeStopped(BrokerInfo brokerInfo) { diff --git a/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java b/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java index aa56a09b2f..a176c9fc7c 100644 --- a/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java @@ -298,7 +298,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br localSessionInfo = new SessionInfo(localConnectionInfo, 1); localBroker.oneway(localSessionInfo); - brokerService.getBroker().networkBridgeStarted(remoteBrokerInfo, this.createdByDuplex); + brokerService.getBroker().networkBridgeStarted(remoteBrokerInfo, this.createdByDuplex, remoteBroker.toString()); NetworkBridgeListener l = this.networkBridgeListener; if (l != null) { l.onStart(this); @@ -347,7 +347,6 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br remoteConnectionInfo.setClientId(configuration.getName() + "_" + configuration.getBrokerName() + "_outbound"); remoteConnectionInfo.setUserName(configuration.getUserName()); remoteConnectionInfo.setPassword(configuration.getPassword()); - remoteConnectionInfo.setClientIp(remoteBroker.toString()); remoteBroker.oneway(remoteConnectionInfo); SessionInfo remoteSessionInfo = new SessionInfo(remoteConnectionInfo, 1); diff --git a/assembly/src/sample-conf/activemq-static-network-broker2.xml b/assembly/src/sample-conf/activemq-static-network-broker2.xml index 9a6db84f5b..d6b86d6c60 100644 --- a/assembly/src/sample-conf/activemq-static-network-broker2.xml +++ b/assembly/src/sample-conf/activemq-static-network-broker2.xml @@ -41,7 +41,7 @@ - +