Java Code Examples for org.apache.activemq.artemis.core.config.Configuration#addConnectorConfiguration()
The following examples show how to use
org.apache.activemq.artemis.core.config.Configuration#addConnectorConfiguration() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultipleLivesMultipleBackupsFailoverTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
protected void createBackupConfig(NodeManager nodeManager, int liveNode, int nodeid, boolean createClusterConnections, int[] otherBackupNodes, int... otherClusterNodes) throws Exception { Configuration config1 = super.createDefaultInVMConfig().clearAcceptorConfigurations().addAcceptorConfiguration(createTransportConfiguration(isNetty(), true, generateParams(nodeid, isNetty()))).setHAPolicyConfiguration(sharedStore ? new SharedStoreSlavePolicyConfiguration() : new ReplicaPolicyConfiguration()).setBindingsDirectory(getBindingsDir() + "_" + liveNode).setJournalDirectory(getJournalDir() + "_" + liveNode).setPagingDirectory(getPageDir() + "_" + liveNode).setLargeMessagesDirectory(getLargeMessagesDir() + "_" + liveNode); for (int node : otherBackupNodes) { TransportConfiguration liveConnector = createTransportConfiguration(isNetty(), false, generateParams(node, isNetty())); config1.addConnectorConfiguration(liveConnector.getName(), liveConnector); } TransportConfiguration backupConnector = createTransportConfiguration(isNetty(), false, generateParams(nodeid, isNetty())); config1.addConnectorConfiguration(backupConnector.getName(), backupConnector); String[] clusterNodes = new String[otherClusterNodes.length]; for (int i = 0; i < otherClusterNodes.length; i++) { TransportConfiguration connector = createTransportConfiguration(isNetty(), false, generateParams(otherClusterNodes[i], isNetty())); config1.addConnectorConfiguration(connector.getName(), connector); clusterNodes[i] = connector.getName(); } config1.addClusterConfiguration(basicClusterConnectionConfig(backupConnector.getName(), clusterNodes)); servers.put(nodeid, new SameProcessActiveMQServer(createInVMFailoverServer(true, config1, nodeManager, liveNode))); }
Example 2
Source File: FederatedTestBase.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Override @Before public void setUp() throws Exception { super.setUp(); for (int i = 0; i < numberOfServers(); i++) { MBeanServer mBeanServer = MBeanServerFactory.createMBeanServer(); mBeanServers.add(mBeanServer); Configuration config = createDefaultConfig(i, false).setSecurityEnabled(false); for (int j = 0; j < numberOfServers(); j++) { config.addConnectorConfiguration("server" + j, "vm://" + j); } ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(config, mBeanServer, false)); servers.add(server); server.start(); configureQueues(server); } }
Example 3
Source File: MultipleLivesMultipleBackupsFailoverTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
protected void createLiveConfig(NodeManager nodeManager, int liveNode, int... otherLiveNodes) throws Exception { TransportConfiguration liveConnector = createTransportConfiguration(isNetty(), false, generateParams(liveNode, isNetty())); Configuration config0 = super.createDefaultInVMConfig().clearAcceptorConfigurations().addAcceptorConfiguration(createTransportConfiguration(isNetty(), true, generateParams(liveNode, isNetty()))).setHAPolicyConfiguration(sharedStore ? new SharedStoreMasterPolicyConfiguration() : new ReplicatedPolicyConfiguration()).setBindingsDirectory(getBindingsDir() + "_" + liveNode).setJournalDirectory(getJournalDir() + "_" + liveNode).setPagingDirectory(getPageDir() + "_" + liveNode).setLargeMessagesDirectory(getLargeMessagesDir() + "_" + liveNode).addConnectorConfiguration(liveConnector.getName(), liveConnector); String[] pairs = new String[otherLiveNodes.length]; for (int i = 0; i < otherLiveNodes.length; i++) { TransportConfiguration otherLiveConnector = createTransportConfiguration(isNetty(), false, generateParams(otherLiveNodes[i], isNetty())); config0.addConnectorConfiguration(otherLiveConnector.getName(), otherLiveConnector); pairs[i] = otherLiveConnector.getName(); } config0.addClusterConfiguration(basicClusterConnectionConfig(liveConnector.getName(), pairs)); servers.put(liveNode, new SameProcessActiveMQServer(createInVMFailoverServer(true, config0, nodeManager, liveNode))); }
Example 4
Source File: SingleLiveMultipleBackupsFailoverTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
protected void createBackupConfig(int liveNode, int nodeid, int... nodes) throws Exception { TransportConfiguration backupConnector = createTransportConfiguration(isNetty(), false, generateParams(nodeid, isNetty())); Configuration config1 = super.createDefaultInVMConfig().clearAcceptorConfigurations().addAcceptorConfiguration(createTransportConfiguration(isNetty(), true, generateParams(nodeid, isNetty()))).setHAPolicyConfiguration(sharedStore ? new SharedStoreSlavePolicyConfiguration() : new ReplicatedPolicyConfiguration()).addConnectorConfiguration(backupConnector.getName(), backupConnector).setBindingsDirectory(getBindingsDir() + "_" + liveNode).setJournalDirectory(getJournalDir() + "_" + liveNode).setPagingDirectory(getPageDir() + "_" + liveNode).setLargeMessagesDirectory(getLargeMessagesDir() + "_" + liveNode); String[] staticConnectors = new String[nodes.length]; for (int i = 0; i < nodes.length; i++) { TransportConfiguration liveConnector = createTransportConfiguration(isNetty(), false, generateParams(nodes[i], isNetty())); config1.addConnectorConfiguration(liveConnector.getName(), liveConnector); staticConnectors[i] = liveConnector.getName(); } config1.addClusterConfiguration(basicClusterConnectionConfig(backupConnector.getName(), staticConnectors)); servers.put(nodeid, new SameProcessActiveMQServer(createInVMFailoverServer(true, config1, nodeManager, nodeid))); }
Example 5
Source File: MultiServerTestBase.java From activemq-artemis with Apache License 2.0 | 5 votes |
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; }
Example 6
Source File: Artemis.java From spring-cloud-ribbon-extensions with Apache License 2.0 | 4 votes |
@Override public void customize(Configuration configuration) { //configuration.addAcceptorConfiguration("netty", "tcp://localhost:" + artemisProperties.getPort()); configuration.addConnectorConfiguration("nettyConnector", new TransportConfiguration(NettyConnectorFactory.class.getName())); configuration.addAcceptorConfiguration(new TransportConfiguration(NettyAcceptorFactory.class.getName())); }
Example 7
Source File: AutomaticColocatedQuorumVoteTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
private Configuration getConfiguration(String identity, boolean scaleDown, TransportConfiguration liveConnector, TransportConfiguration liveAcceptor, TransportConfiguration... otherLiveNodes) throws Exception { Configuration configuration = createDefaultInVMConfig().clearAcceptorConfigurations().addAcceptorConfiguration(liveAcceptor).addConnectorConfiguration(liveConnector.getName(), liveConnector).setJournalDirectory(getJournalDir() + identity).setBindingsDirectory(getBindingsDir() + identity).setLargeMessagesDirectory(getLargeMessagesDir() + identity).setPagingDirectory(getPageDir() + identity).addQueueConfiguration(new QueueConfiguration("testQueue")); List<String> transportConfigurationList = new ArrayList<>(); final ColocatedPolicyConfiguration haPolicy = new ColocatedPolicyConfiguration(); for (TransportConfiguration otherLiveNode : otherLiveNodes) { configuration.addConnectorConfiguration(otherLiveNode.getName(), otherLiveNode); transportConfigurationList.add(otherLiveNode.getName()); haPolicy.getExcludedConnectors().add(otherLiveNode.getName()); } String[] input = new String[transportConfigurationList.size()]; transportConfigurationList.toArray(input); configuration.addClusterConfiguration(basicClusterConnectionConfig(liveConnector.getName(), input)); haPolicy.setBackupPortOffset(100); haPolicy.setBackupRequestRetries(-1); haPolicy.setBackupRequestRetryInterval(500); haPolicy.setMaxBackups(1); haPolicy.setRequestBackup(true); configuration.setHAPolicyConfiguration(haPolicy); if (!replicated) { SharedStoreMasterPolicyConfiguration ssmc = new SharedStoreMasterPolicyConfiguration(); SharedStoreSlavePolicyConfiguration sssc = new SharedStoreSlavePolicyConfiguration(); haPolicy.setLiveConfig(ssmc); haPolicy.setBackupConfig(sssc); if (scaleDown) { sssc.setScaleDownConfiguration(new ScaleDownConfiguration()); } } else { ReplicatedPolicyConfiguration rpc = new ReplicatedPolicyConfiguration(); ReplicaPolicyConfiguration rpc2 = new ReplicaPolicyConfiguration(); haPolicy.setLiveConfig(rpc); haPolicy.setBackupConfig(rpc2); if (scaleDown) { rpc2.setScaleDownConfiguration(new ScaleDownConfiguration()); } } return configuration; }