use of org.apache.activemq.network.DiscoveryNetworkConnector in project fabric8 by jboss-fuse.
the class ActiveMQServiceFactory method createNetworkConnector.
private NetworkConnector createNetworkConnector(URI uri, Properties properties) throws URISyntaxException, IOException {
NetworkConnector nc = new DiscoveryNetworkConnector(uri);
Map<String, Object> networkProperties = new HashMap<String, Object>();
// use default credentials for network connector (if none was specified)
networkProperties.put("network.userName", "admin");
networkProperties.put("network.password", properties.getProperty("zookeeper.password"));
for (String k : properties.stringPropertyNames()) {
networkProperties.put(k, properties.getProperty(k));
}
IntrospectionSupport.setProperties(nc, networkProperties, "network.");
return nc;
}
use of org.apache.activemq.network.DiscoveryNetworkConnector in project activemq-artemis by apache.
the class JmsMultipleBrokersTestSupport method bridgeBrokers.
// Overwrite this method to specify how you want to bridge the two brokers
// By default, bridge them using add network connector of the local broker
// and the first connector of the remote broker
protected NetworkConnector bridgeBrokers(BrokerService localBroker, BrokerService remoteBroker, boolean dynamicOnly, int networkTTL, boolean conduit, boolean failover) throws Exception {
List<TransportConnector> transportConnectors = remoteBroker.getTransportConnectors();
URI remoteURI;
if (!transportConnectors.isEmpty()) {
remoteURI = transportConnectors.get(0).getConnectUri();
String uri = "static:(" + remoteURI + ")";
if (failover) {
uri = "static:(failover:(" + remoteURI + "))";
}
NetworkConnector connector = new DiscoveryNetworkConnector(new URI(uri));
connector.setName("to-" + remoteBroker.getBrokerName());
connector.setDynamicOnly(dynamicOnly);
connector.setNetworkTTL(networkTTL);
connector.setConduitSubscriptions(conduit);
localBroker.addNetworkConnector(connector);
maxSetupTime = 2000;
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 ThreeBrokerStompTemporaryQueueTest method bridgeBrokers.
@Override
protected NetworkConnector bridgeBrokers(BrokerService localBroker, BrokerService remoteBroker, boolean dynamicOnly, int networkTTL, boolean conduit, boolean failover) throws Exception {
List<TransportConnector> transportConnectors = remoteBroker.getTransportConnectors();
URI remoteURI;
if (!transportConnectors.isEmpty()) {
remoteURI = transportConnectors.get(0).getConnectUri();
NetworkConnector connector = new DiscoveryNetworkConnector(new URI("static:" + remoteURI));
connector.setName(localBroker.getBrokerName() + remoteBroker.getBrokerName());
localBroker.addNetworkConnector(connector);
maxSetupTime = 2000;
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 BrokerQueueNetworkWithDisconnectTest method bridgeBrokers.
@Override
protected NetworkConnector bridgeBrokers(BrokerService localBroker, BrokerService remoteBroker, boolean dynamicOnly, int networkTTL, boolean conduit, boolean 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();
}
DiscoveryNetworkConnector connector = new DiscoveryNetworkConnector(new URI("static:(" + remoteURI + "?wireFormat.maxInactivityDuration=" + inactiveDuration + "&wireFormat.maxInactivityDurationInitalDelay=" + inactiveDuration + ")?useExponentialBackOff=false"));
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 MulticastDiscoveryOnFaultyNetworkTest method bridgeBrokers.
@Override
protected NetworkConnector bridgeBrokers(BrokerService localBroker, BrokerService remoteBroker, boolean dynamicOnly, int networkTTL, boolean conduit, boolean failover) throws Exception {
String networkDisoveryUrlString = useStaticDiscovery ? "static:(" + remoteBroker.getTransportConnectors().get(0).getPublishableConnectString() + ")?useExponentialBackOff=false" : "multicast://default?group=TESTERIC&useLocalHost=false";
DiscoveryNetworkConnector connector = new DiscoveryNetworkConnector(new URI(networkDisoveryUrlString));
connector.setDynamicOnly(dynamicOnly);
connector.setNetworkTTL(networkTTL);
connector.setDuplex(useDuplexNetworkBridge);
maxSetupTime = 2000;
if (!useStaticDiscovery) {
List<TransportConnector> transportConnectors = remoteBroker.getTransportConnectors();
if (!transportConnectors.isEmpty()) {
TransportConnector mCastTrpConnector = (transportConnectors.get(0));
mCastTrpConnector.setDiscoveryUri(new URI("multicast://default?group=TESTERIC"));
}
}
localBroker.addNetworkConnector(connector);
return connector;
}
Aggregations