use of org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration in project activemq-artemis by apache.
the class MultiServerTestBase method setupBackupServer.
protected ActiveMQServer setupBackupServer(final int node, final int liveNode, final NodeManager nodeManager) throws Exception {
TransportConfiguration serverConfigAcceptor = createTransportConfiguration(useNetty(), true, generateParams(node, useNetty()));
TransportConfiguration thisConnector = createTransportConfiguration(useNetty(), false, generateParams(node, useNetty()));
Configuration configuration = createBasicConfig(useSharedStorage() ? liveNode : node).clearAcceptorConfigurations().addAcceptorConfiguration(serverConfigAcceptor).addConnectorConfiguration("thisConnector", thisConnector).setHAPolicyConfiguration(useSharedStorage() ? new SharedStoreSlavePolicyConfiguration() : new ReplicaPolicyConfiguration());
List<String> targetServersOnConnection = new ArrayList<>();
for (int targetNode = 0; targetNode < getNumberOfServers(); targetNode++) {
// if (targetNode == node)
// {
// // moving on from itself
// continue;
// }
String targetConnectorName = "targetConnector-" + targetNode;
TransportConfiguration targetServer = createTransportConfiguration(useNetty(), false, generateParams(targetNode, useNetty()));
configuration.addConnectorConfiguration(targetConnectorName, targetServer);
targetServersOnConnection.add(targetConnectorName);
}
ClusterConnectionConfiguration clusterConf = new ClusterConnectionConfiguration().setName("localCluster" + node).setAddress("cluster-queues").setConnectorName("thisConnector").setRetryInterval(100).setConfirmationWindowSize(1024).setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND).setStaticConnectors(targetServersOnConnection);
configuration.getClusterConfigurations().add(clusterConf);
ActiveMQServer server;
if (useSharedStorage()) {
server = createInVMFailoverServer(true, configuration, nodeManager, liveNode);
} else {
server = addServer(ActiveMQServers.newActiveMQServer(configuration, useRealFiles()));
}
server.setIdentity(this.getClass().getSimpleName() + "/Backup(" + node + " of live " + liveNode + ")");
return server;
}
use of org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration in project activemq-artemis by apache.
the class MultiServerTestBase method setupLiveServer.
protected Pair<ActiveMQServer, NodeManager> setupLiveServer(final int node, final boolean realFiles, final boolean sharedStorage) throws Exception {
NodeManager nodeManager = null;
TransportConfiguration serverConfigAcceptor = createTransportConfiguration(useNetty(), true, generateParams(node, useNetty()));
TransportConfiguration thisConnector = createTransportConfiguration(useNetty(), false, generateParams(node, useNetty()));
if (sharedStorage) {
nodeManager = new InVMNodeManager(false);
}
Configuration configuration = createBasicConfig(node).setJournalMaxIO_AIO(1000).setThreadPoolMaxSize(10).clearAcceptorConfigurations().addAcceptorConfiguration(serverConfigAcceptor).addConnectorConfiguration("thisConnector", thisConnector).setHAPolicyConfiguration(sharedStorage ? new SharedStoreMasterPolicyConfiguration() : new ReplicatedPolicyConfiguration());
List<String> targetServersOnConnection = new ArrayList<>();
for (int targetNode = 0; targetNode < getNumberOfServers(); targetNode++) {
if (targetNode == node) {
continue;
}
String targetConnectorName = "target-" + targetNode;
TransportConfiguration targetServer = createTransportConfiguration(useNetty(), false, generateParams(targetNode, useNetty()));
configuration.getConnectorConfigurations().put(targetConnectorName, targetServer);
targetServersOnConnection.add(targetConnectorName);
// The connector towards a backup.. just to have a reference so bridges can connect to backups on their configs
String backupConnectorName = "backup-" + targetNode;
TransportConfiguration backupConnector = createTransportConfiguration(useNetty(), false, generateParams(targetNode + getNumberOfServers(), useNetty()));
configuration.getConnectorConfigurations().put(backupConnectorName, backupConnector);
}
ClusterConnectionConfiguration clusterConf = new ClusterConnectionConfiguration().setName("localCluster" + node).setAddress("cluster-queues").setConnectorName("thisConnector").setRetryInterval(100).setConfirmationWindowSize(1024).setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND).setStaticConnectors(targetServersOnConnection);
configuration.getClusterConfigurations().add(clusterConf);
ActiveMQServer server;
if (sharedStorage) {
server = createInVMFailoverServer(realFiles, configuration, nodeManager, node);
} else {
server = createServer(realFiles, configuration);
}
server.setIdentity(this.getClass().getSimpleName() + "/Live(" + node + ")");
addServer(server);
return new Pair<>(server, nodeManager);
}
use of org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration in project activemq-artemis by apache.
the class SpawnedServerSupport method setupClusterConn.
protected static final ClusterConnectionConfiguration setupClusterConn(String connectorName, String... connectors) {
List<String> connectorList = new LinkedList<>();
for (String conn : connectors) {
connectorList.add(conn);
}
ClusterConnectionConfiguration ccc = new ClusterConnectionConfiguration().setName("cluster1").setAddress("jms").setConnectorName(connectorName).setRetryInterval(10).setDuplicateDetection(false).setMessageLoadBalancingType(MessageLoadBalancingType.STRICT).setConfirmationWindowSize(1).setStaticConnectors(connectorList);
return ccc;
}
use of org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration in project activemq-artemis by apache.
the class ClusterConnectionStaticSchema method internalNewObject.
@Override
protected ClusterConnectionConfiguration internalNewObject(URI uri, Map<String, String> query, String param) throws Exception {
ClusterConnectionConfiguration configuration = new ClusterConnectionConfiguration();
populateObject(uri, configuration);
return configuration;
}
use of org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration in project activemq-artemis by apache.
the class ClusterTestBase method setupClusterConnection.
protected void setupClusterConnection(final String name, final int nodeFrom, final int nodeTo, final String address, final MessageLoadBalancingType messageLoadBalancingType, final int maxHops, final int reconnectAttempts, final long retryInterval, final boolean netty, final boolean allowDirectConnectionsOnly) {
ActiveMQServer serverFrom = servers[nodeFrom];
if (serverFrom == null) {
throw new IllegalStateException("No server at node " + nodeFrom);
}
TransportConfiguration connectorFrom = createTransportConfiguration(netty, false, generateParams(nodeFrom, netty));
serverFrom.getConfiguration().getConnectorConfigurations().put(name, connectorFrom);
List<String> pairs = null;
if (nodeTo != -1) {
TransportConfiguration serverTotc = createTransportConfiguration(netty, false, generateParams(nodeTo, netty));
serverFrom.getConfiguration().getConnectorConfigurations().put(serverTotc.getName(), serverTotc);
pairs = new ArrayList<>();
pairs.add(serverTotc.getName());
}
Configuration config = serverFrom.getConfiguration();
ClusterConnectionConfiguration clusterConf = new ClusterConnectionConfiguration().setName(name).setAddress(address).setConnectorName(name).setReconnectAttempts(reconnectAttempts).setRetryInterval(retryInterval).setMessageLoadBalancingType(messageLoadBalancingType).setMaxHops(maxHops).setConfirmationWindowSize(1024).setStaticConnectors(pairs).setAllowDirectConnectionsOnly(allowDirectConnectionsOnly);
config.getClusterConfigurations().add(clusterConf);
}
Aggregations