Allow the local destination name to be set -

re this thread on the user list: http://www.nabble.com/JMS-to-JMS-Bridge-tf1901141.html#a5598457

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@427656 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2006-08-01 17:31:47 +00:00
parent f998bc7398
commit 902a8ea864
6 changed files with 86 additions and 6 deletions

View File

@ -28,12 +28,14 @@ package org.apache.activemq.network.jms;
public class InboundQueueBridge extends QueueBridge{ public class InboundQueueBridge extends QueueBridge{
String inboundQueueName; String inboundQueueName;
String localQueueName;
/** /**
* Constructor that takes a foriegn destination as an argument * Constructor that takes a foriegn destination as an argument
* @param inboundQueueName * @param inboundQueueName
*/ */
public InboundQueueBridge(String inboundQueueName){ public InboundQueueBridge(String inboundQueueName){
this.inboundQueueName = inboundQueueName; this.inboundQueueName = inboundQueueName;
this.localQueueName = inboundQueueName;
} }
/** /**
@ -54,6 +56,23 @@ public class InboundQueueBridge extends QueueBridge{
*/ */
public void setInboundQueueName(String inboundQueueName){ public void setInboundQueueName(String inboundQueueName){
this.inboundQueueName=inboundQueueName; this.inboundQueueName=inboundQueueName;
if (this.localQueueName == null){
this.localQueueName = inboundQueueName;
}
}
/**
* @return the localQueueName
*/
public String getLocalQueueName(){
return localQueueName;
}
/**
* @param localQueueName the localQueueName to set
*/
public void setLocalQueueName(String localQueueName){
this.localQueueName=localQueueName;
} }
} }

View File

@ -28,12 +28,14 @@ package org.apache.activemq.network.jms;
public class InboundTopicBridge extends TopicBridge{ public class InboundTopicBridge extends TopicBridge{
String inboundTopicName; String inboundTopicName;
String localTopicName;
/** /**
* Constructor that takes a foriegn destination as an argument * Constructor that takes a foriegn destination as an argument
* @param inboundTopicName * @param inboundTopicName
*/ */
public InboundTopicBridge(String inboundTopicName){ public InboundTopicBridge(String inboundTopicName){
this.inboundTopicName = inboundTopicName; this.inboundTopicName = inboundTopicName;
this.localTopicName = inboundTopicName;
} }
/** /**
@ -50,10 +52,27 @@ public class InboundTopicBridge extends TopicBridge{
} }
/** /**
* @param outboundTopicName The outboundTopicName to set. * @param inboundTopicName
*/ */
public void setInboundTopicName(String inboundTopicName){ public void setInboundTopicName(String inboundTopicName){
this.inboundTopicName=inboundTopicName; this.inboundTopicName=inboundTopicName;
if(this.localTopicName==null){
this.localTopicName = inboundTopicName;
}
}
/**
* @return the localTopicName
*/
public String getLocalTopicName(){
return localTopicName;
}
/**
* @param localTopicName the localTopicName to set
*/
public void setLocalTopicName(String localTopicName){
this.localTopicName=localTopicName;
} }
} }

View File

@ -263,8 +263,9 @@ public class JmsQueueConnector extends JmsConnector{
QueueSession localSession = localQueueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE); QueueSession localSession = localQueueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
for(int i=0;i<inboundQueueBridges.length;i++){ for(int i=0;i<inboundQueueBridges.length;i++){
InboundQueueBridge bridge=inboundQueueBridges[i]; InboundQueueBridge bridge=inboundQueueBridges[i];
String queueName=bridge.getInboundQueueName(); String localQueueName=bridge.getLocalQueueName();
Queue activemqQueue=createActiveMQQueue(localSession,queueName); Queue activemqQueue=createActiveMQQueue(localSession,localQueueName);
String queueName = bridge.getInboundQueueName();
Queue foreignQueue=createForeignQueue(outboundSession,queueName); Queue foreignQueue=createForeignQueue(outboundSession,queueName);
bridge.setConsumerQueue(foreignQueue); bridge.setConsumerQueue(foreignQueue);
bridge.setProducerQueue(activemqQueue); bridge.setProducerQueue(activemqQueue);
@ -287,8 +288,9 @@ public class JmsQueueConnector extends JmsConnector{
QueueSession localSession = localQueueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE); QueueSession localSession = localQueueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
for(int i=0;i<outboundQueueBridges.length;i++){ for(int i=0;i<outboundQueueBridges.length;i++){
OutboundQueueBridge bridge=outboundQueueBridges[i]; OutboundQueueBridge bridge=outboundQueueBridges[i];
String localQueueName=bridge.getLocalQueueName();
Queue activemqQueue=createActiveMQQueue(localSession,localQueueName);
String queueName=bridge.getOutboundQueueName(); String queueName=bridge.getOutboundQueueName();
Queue activemqQueue=createActiveMQQueue(localSession,queueName);
Queue foreignQueue=createForeignQueue(outboundSession,queueName); Queue foreignQueue=createForeignQueue(outboundSession,queueName);
bridge.setConsumerQueue(activemqQueue); bridge.setConsumerQueue(activemqQueue);
bridge.setProducerQueue(foreignQueue); bridge.setProducerQueue(foreignQueue);

View File

@ -265,8 +265,9 @@ public class JmsTopicConnector extends JmsConnector{
TopicSession localSession = localTopicConnection.createTopicSession(false,Session.AUTO_ACKNOWLEDGE); TopicSession localSession = localTopicConnection.createTopicSession(false,Session.AUTO_ACKNOWLEDGE);
for(int i=0;i<inboundTopicBridges.length;i++){ for(int i=0;i<inboundTopicBridges.length;i++){
InboundTopicBridge bridge=inboundTopicBridges[i]; InboundTopicBridge bridge=inboundTopicBridges[i];
String localTopicName=bridge.getLocalTopicName();
Topic activemqTopic=createActiveMQTopic(localSession,localTopicName);
String topicName=bridge.getInboundTopicName(); String topicName=bridge.getInboundTopicName();
Topic activemqTopic=createActiveMQTopic(localSession,topicName);
Topic foreignTopic=createForeignTopic(outboundSession,topicName); Topic foreignTopic=createForeignTopic(outboundSession,topicName);
bridge.setConsumerTopic(foreignTopic); bridge.setConsumerTopic(foreignTopic);
bridge.setProducerTopic(activemqTopic); bridge.setProducerTopic(activemqTopic);
@ -289,8 +290,9 @@ public class JmsTopicConnector extends JmsConnector{
TopicSession localSession = localTopicConnection.createTopicSession(false,Session.AUTO_ACKNOWLEDGE); TopicSession localSession = localTopicConnection.createTopicSession(false,Session.AUTO_ACKNOWLEDGE);
for(int i=0;i<outboundTopicBridges.length;i++){ for(int i=0;i<outboundTopicBridges.length;i++){
OutboundTopicBridge bridge=outboundTopicBridges[i]; OutboundTopicBridge bridge=outboundTopicBridges[i];
String localTopicName=bridge.getLocalTopicName();
Topic activemqTopic=createActiveMQTopic(localSession,localTopicName);
String topicName=bridge.getOutboundTopicName(); String topicName=bridge.getOutboundTopicName();
Topic activemqTopic=createActiveMQTopic(localSession,topicName);
Topic foreignTopic=createForeignTopic(outboundSession,topicName); Topic foreignTopic=createForeignTopic(outboundSession,topicName);
bridge.setConsumerTopic(activemqTopic); bridge.setConsumerTopic(activemqTopic);
bridge.setProducerTopic(foreignTopic); bridge.setProducerTopic(foreignTopic);

View File

@ -28,12 +28,14 @@ package org.apache.activemq.network.jms;
public class OutboundQueueBridge extends QueueBridge{ public class OutboundQueueBridge extends QueueBridge{
String outboundQueueName; String outboundQueueName;
String localQueueName;
/** /**
* Constructor that takes a foreign destination as an argument * Constructor that takes a foreign destination as an argument
* @param outboundQueueName * @param outboundQueueName
*/ */
public OutboundQueueBridge(String outboundQueueName){ public OutboundQueueBridge(String outboundQueueName){
this.outboundQueueName = outboundQueueName; this.outboundQueueName = outboundQueueName;
this.localQueueName = outboundQueueName;
} }
/** /**
@ -54,6 +56,23 @@ public class OutboundQueueBridge extends QueueBridge{
*/ */
public void setOutboundQueueName(String outboundQueueName){ public void setOutboundQueueName(String outboundQueueName){
this.outboundQueueName=outboundQueueName; this.outboundQueueName=outboundQueueName;
if (this.localQueueName==null){
this.localQueueName=outboundQueueName;
}
}
/**
* @return the localQueueName
*/
public String getLocalQueueName(){
return localQueueName;
}
/**
* @param localQueueName the localQueueName to set
*/
public void setLocalQueueName(String localQueueName){
this.localQueueName=localQueueName;
} }
} }

View File

@ -28,12 +28,14 @@ package org.apache.activemq.network.jms;
public class OutboundTopicBridge extends TopicBridge{ public class OutboundTopicBridge extends TopicBridge{
String outboundTopicName; String outboundTopicName;
String localTopicName;
/** /**
* Constructor that takes a foreign destination as an argument * Constructor that takes a foreign destination as an argument
* @param outboundTopicName * @param outboundTopicName
*/ */
public OutboundTopicBridge(String outboundTopicName){ public OutboundTopicBridge(String outboundTopicName){
this.outboundTopicName = outboundTopicName; this.outboundTopicName = outboundTopicName;
this.localTopicName = outboundTopicName;
} }
/** /**
@ -54,6 +56,23 @@ public class OutboundTopicBridge extends TopicBridge{
*/ */
public void setOutboundTopicName(String outboundTopicName){ public void setOutboundTopicName(String outboundTopicName){
this.outboundTopicName=outboundTopicName; this.outboundTopicName=outboundTopicName;
if(this.localTopicName==null){
this.localTopicName=outboundTopicName;
}
}
/**
* @return the localTopicName
*/
public String getLocalTopicName(){
return localTopicName;
}
/**
* @param localTopicName the localTopicName to set
*/
public void setLocalTopicName(String localTopicName){
this.localTopicName=localTopicName;
} }
} }