mirror of https://github.com/apache/activemq.git
https://issues.apache.org/activemq/browse/AMQ-2767 - proxyToLocalBroker <proxyConnector> property
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@952642 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9ae0d32769
commit
121ecb5599
|
@ -45,6 +45,11 @@ public class ProxyConnector implements Service {
|
|||
private URI remote;
|
||||
private URI localUri;
|
||||
private String name;
|
||||
/**
|
||||
* Should we proxy commands to the local broker using VM transport as well?
|
||||
*/
|
||||
private boolean proxyToLocalBroker = true;
|
||||
|
||||
private final CopyOnWriteArrayList<ProxyConnection> connections = new CopyOnWriteArrayList<ProxyConnection>();
|
||||
|
||||
public void start() throws Exception {
|
||||
|
@ -131,11 +136,11 @@ public class ProxyConnector implements Service {
|
|||
private Transport createRemoteTransport() throws Exception {
|
||||
Transport transport = TransportFactory.compositeConnect(remote);
|
||||
CompositeTransport ct = transport.narrow(CompositeTransport.class);
|
||||
if (ct != null && localUri != null) {
|
||||
if (ct != null && localUri != null && proxyToLocalBroker) {
|
||||
ct.add(false,new URI[] {localUri});
|
||||
}
|
||||
|
||||
// Add a transport filter so that can track the transport life cycle
|
||||
// Add a transport filter so that we can track the transport life cycle
|
||||
transport = new TransportFilter(transport) {
|
||||
@Override
|
||||
public void stop() throws Exception {
|
||||
|
@ -162,4 +167,12 @@ public class ProxyConnector implements Service {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public boolean isProxyToLocalBroker() {
|
||||
return proxyToLocalBroker;
|
||||
}
|
||||
|
||||
public void setProxyToLocalBroker(boolean proxyToLocalBroker) {
|
||||
this.proxyToLocalBroker = proxyToLocalBroker;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ public class ProxyTestSupport extends BrokerTestSupport {
|
|||
BrokerService service = new BrokerService();
|
||||
service.setBrokerName("broker1");
|
||||
service.setPersistent(false);
|
||||
service.setUseJmx(false);
|
||||
|
||||
connector = service.addConnector(getLocalURI());
|
||||
proxyConnector = new ProxyConnector();
|
||||
|
@ -61,6 +62,7 @@ public class ProxyTestSupport extends BrokerTestSupport {
|
|||
BrokerService service = new BrokerService();
|
||||
service.setBrokerName("broker2");
|
||||
service.setPersistent(false);
|
||||
service.setUseJmx(false);
|
||||
|
||||
remoteConnector = service.addConnector(getRemoteURI());
|
||||
remoteProxyConnector = new ProxyConnector();
|
||||
|
|
Loading…
Reference in New Issue