use of org.apache.activemq.network.DiscoveryNetworkConnector in project activemq-artemis by apache.
the class NetworkAsyncStartTest method bridgeBroker.
private void bridgeBroker(BrokerService localBroker, String remoteURI) throws Exception {
String uri = "static:(" + remoteURI + ")";
NetworkConnector connector = new DiscoveryNetworkConnector(new URI(uri));
connector.setName("bridge-" + bridgeCount++);
localBroker.addNetworkConnector(connector);
}
use of org.apache.activemq.network.DiscoveryNetworkConnector in project activemq-artemis by apache.
the class DurableSubInBrokerNetworkTest method setUp.
@Override
protected void setUp() throws Exception {
useJmx = true;
super.setUp();
URI ncUri = new URI("static:(" + connector.getConnectUri().toString() + ")");
NetworkConnector nc = new DiscoveryNetworkConnector(ncUri);
nc.setDuplex(true);
remoteBroker.addNetworkConnector(nc);
nc.start();
}
use of org.apache.activemq.network.DiscoveryNetworkConnector in project activemq-artemis by apache.
the class DurableSubscriberWithNetworkDisconnectTest method bridgeBrokers.
@Override
protected NetworkConnector bridgeBrokers(BrokerService localBroker, BrokerService remoteBroker, boolean l_dynamicOnly, int networkTTL, boolean l_conduit, boolean l_failover) throws Exception {
List<TransportConnector> transportConnectors = remoteBroker.getTransportConnectors();
URI remoteURI;
if (!transportConnectors.isEmpty()) {
remoteURI = transportConnectors.get(0).getConnectUri();
if (useSocketProxy) {
socketProxy = new SocketProxy(remoteURI);
remoteURI = socketProxy.getUrl();
}
String options = "";
if (failover) {
options = "static:(failover:(" + remoteURI;
} else {
options = "static:(" + remoteURI;
}
if (inactivity) {
options += "?wireFormat.maxInactivityDuration=" + inactiveDuration + "&wireFormat.maxInactivityDurationInitalDelay=" + inactiveDuration + ")";
} else {
options += ")";
}
if (failover) {
options += "?maxReconnectAttempts=0)";
}
options += "?useExponentialBackOff=" + exponentialBackOff;
DiscoveryNetworkConnector connector = new DiscoveryNetworkConnector(new URI(options));
connector.setDynamicOnly(dynamicOnly);
connector.setNetworkTTL(networkTTL);
localBroker.addNetworkConnector(connector);
maxSetupTime = 2000;
if (useDuplexNetworkBridge) {
connector.setDuplex(true);
}
return connector;
} else {
throw new Exception("Remote broker has no registered connectors.");
}
}
use of org.apache.activemq.network.DiscoveryNetworkConnector in project activemq-artemis by apache.
the class AMQStackOverFlowTest method createBrokerService.
private BrokerService createBrokerService(final String brokerName, final String uri1, final String uri2) throws Exception {
final BrokerService brokerService = new BrokerService();
brokerService.setBrokerName(brokerName);
brokerService.setPersistent(false);
brokerService.setUseJmx(true);
final SystemUsage memoryManager = new SystemUsage();
// memoryManager.getMemoryUsage().setLimit(10);
brokerService.setSystemUsage(memoryManager);
final List<PolicyEntry> policyEntries = new ArrayList<>();
final PolicyEntry entry = new PolicyEntry();
entry.setQueue(">");
// entry.setMemoryLimit(1);
policyEntries.add(entry);
final PolicyMap policyMap = new PolicyMap();
policyMap.setPolicyEntries(policyEntries);
brokerService.setDestinationPolicy(policyMap);
final TransportConnector tConnector = new TransportConnector();
tConnector.setUri(new URI(uri1));
tConnector.setName(brokerName + ".transportConnector");
brokerService.addConnector(tConnector);
if (uri2 != null) {
final NetworkConnector nc = new DiscoveryNetworkConnector(new URI("static:" + uri2));
nc.setBridgeTempDestinations(true);
nc.setBrokerName(brokerName);
// nc.setPrefetchSize(1);
brokerService.addNetworkConnector(nc);
}
return brokerService;
}
Aggregations