Add a name to a bridge - so multiple bridges between the same two brokers can be used

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@380616 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2006-02-24 08:04:24 +00:00
parent 33094e694a
commit 6c1d45e1fc
3 changed files with 28 additions and 9 deletions

View File

@ -76,6 +76,7 @@ public class DemandForwardingBridge implements Bridge{
protected int prefetchSize=1000;
protected boolean dispatchAsync;
protected String destinationFilter=">";
protected String name = "bridge";
protected ConsumerInfo demandConsumerInfo;
protected int demandConsumerDispatched;
protected AtomicBoolean localBridgeStarted=new AtomicBoolean(false);
@ -173,7 +174,7 @@ public class DemandForwardingBridge implements Bridge{
if(localBridgeStarted.compareAndSet(false,true)){
localConnectionInfo=new ConnectionInfo();
localConnectionInfo.setConnectionId(new ConnectionId(idGenerator.generateId()));
localClientId="NC_"+remoteBrokerName+"_inbound";
localClientId="NC_"+remoteBrokerName+"_inbound"+name;
localConnectionInfo.setClientId(localClientId);
localBroker.oneway(localConnectionInfo);
localSessionInfo=new SessionInfo(localConnectionInfo,1);
@ -192,7 +193,7 @@ public class DemandForwardingBridge implements Bridge{
remoteBroker.oneway(brokerInfo);
remoteConnectionInfo=new ConnectionInfo();
remoteConnectionInfo.setConnectionId(new ConnectionId(idGenerator.generateId()));
remoteConnectionInfo.setClientId("NC_"+localBrokerName+"_outbound");
remoteConnectionInfo.setClientId("NC_"+localBrokerName+"_outbound"+name);
remoteBroker.oneway(remoteConnectionInfo);
SessionInfo remoteSessionInfo=new SessionInfo(remoteConnectionInfo,1);
remoteBroker.oneway(remoteSessionInfo);
@ -552,17 +553,17 @@ public class DemandForwardingBridge implements Bridge{
/**
* @return Returns the remoteBrokerName.
* @return Returns the name.
*/
public String getRemoteBrokerName(){
return remoteBrokerName;
public String getName(){
return name;
}
/**
* @param remoteBrokerName The remoteBrokerName to set.
* @param name The name to set.
*/
public void setRemoteBrokerName(String remoteBrokerName){
this.remoteBrokerName=remoteBrokerName;
public void setName(String name){
this.name=name;
}
/**
@ -777,6 +778,8 @@ public class DemandForwardingBridge implements Bridge{
}

View File

@ -53,7 +53,7 @@ public class DurableConduitBridge extends ConduitBridge{
if(isPermissableDestination(dest) && !doesConsumerExist(dest)){
DemandSubscription sub=createDemandSubscription(dest);
if(dest.isTopic()){
sub.getLocalInfo().setSubcriptionName(getLocalBrokerName());
sub.getLocalInfo().setSubcriptionName(getLocalBrokerName()+"_"+name);
}
try{
addSubscription(sub);

View File

@ -60,6 +60,7 @@ public class NetworkConnector implements Service, DiscoveryListener {
private boolean conduitSubscriptions = true;
private boolean decreaseNetworkConsumerPriority;
private int networkTTL = 1;
private String name = "bridge";
public NetworkConnector(){
@ -222,6 +223,20 @@ public class NetworkConnector implements Service, DiscoveryListener {
public void setBrokerName(String brokerName){
this.brokerName=brokerName;
}
/**
* @return Returns the name.
*/
public String getName(){
return name;
}
/**
* @param name The name to set.
*/
public void setName(String name){
this.name=name;
}
/**
@ -392,6 +407,7 @@ public class NetworkConnector implements Service, DiscoveryListener {
};
}
result.setLocalBrokerName(brokerName);
result.setName(getBrokerName());
result.setNetworkTTL(getNetworkTTL());
result.setDecreaseNetworkConsumerPriority(isDecreaseNetworkConsumerPriority());