diff --git a/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsConnector.java b/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsConnector.java index 0c102304a9..5c9e753f1b 100755 --- a/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsConnector.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsConnector.java @@ -59,6 +59,8 @@ public abstract class JmsConnector implements Service { protected String outboundPassword; protected String localUsername; protected String localPassword; + protected String outboundClientId; + protected String localClientId; protected LRUCache replyToBridges = createLRUCache(); private List inboundBridges = new CopyOnWriteArrayList(); @@ -277,7 +279,36 @@ public abstract class JmsConnector implements Service { public void setOutboundUsername(String outboundUsername) { this.outboundUsername = outboundUsername; } + + /** + * @return the outboundClientId + */ + public String getOutboundClientId() { + return outboundClientId; + } + /** + * @param outboundClientId the outboundClientId to set + */ + public void setOutboundClientId(String outboundClientId) { + this.outboundClientId = outboundClientId; + } + + /** + * @return the localClientId + */ + public String getLocalClientId() { + return localClientId; + } + + /** + * @param localClientId the localClientId to set + */ + public void setLocalClientId(String localClientId) { + this.localClientId = localClientId; + } + + protected void addInboundBridge(DestinationBridge bridge) { inboundBridges.add(bridge); } diff --git a/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsQueueConnector.java b/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsQueueConnector.java index c2cfdc2393..51d0bfaba9 100755 --- a/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsQueueConnector.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsQueueConnector.java @@ -210,6 +210,9 @@ public class JmsQueueConnector extends JmsConnector { } } } + if (localClientId != null && localClientId.length() > 0) { + outboundQueueConnection.setClientID(getOutboundClientId()); + } outboundQueueConnection.start(); } @@ -243,6 +246,9 @@ public class JmsQueueConnector extends JmsConnector { } } } + if (localClientId != null && localClientId.length() > 0) { + localQueueConnection.setClientID(getLocalClientId()); + } localQueueConnection.start(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsTopicConnector.java b/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsTopicConnector.java index 3eea3b3e3f..2e98747f9b 100755 --- a/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsTopicConnector.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsTopicConnector.java @@ -210,6 +210,9 @@ public class JmsTopicConnector extends JmsConnector { } } } + if (localClientId != null && localClientId.length() > 0) { + outboundTopicConnection.setClientID(getOutboundClientId()); + } outboundTopicConnection.start(); } @@ -243,6 +246,9 @@ public class JmsTopicConnector extends JmsConnector { } } } + if (localClientId != null && localClientId.length() > 0) { + localTopicConnection.setClientID(getLocalClientId()); + } localTopicConnection.start(); }