Search in sources :

Example 11 with ClusterConnectionConfiguration

use of org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration in project activemq-artemis by apache.

the class JMSClusteredTestBase method createConfigServer.

/**
 * @return
 */
protected Configuration createConfigServer(final int source, final int destination) throws Exception {
    final String destinationLabel = "toServer" + destination;
    final String sourceLabel = "server" + source;
    Configuration configuration = createDefaultInVMConfig(source).setSecurityEnabled(false).setJMXManagementEnabled(true).setPersistenceEnabled(false).addConnectorConfiguration(destinationLabel, new TransportConfiguration(InVMConnectorFactory.class.getName(), generateInVMParams(destination))).addConnectorConfiguration(sourceLabel, new TransportConfiguration(InVMConnectorFactory.class.getName(), generateInVMParams(source))).addClusterConfiguration(new ClusterConnectionConfiguration().setName(destinationLabel).setConnectorName(sourceLabel).setRetryInterval(250).setMaxHops(MAX_HOPS).setConfirmationWindowSize(1024).setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND).setStaticConnectors(new ArrayList<String>() {

        {
            add(destinationLabel);
        }
    }));
    configuration.getAddressesSettings().put("#", new AddressSettings().setRedistributionDelay(0));
    return configuration;
}
Also used : ClusterConnectionConfiguration(org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration) AddressSettings(org.apache.activemq.artemis.core.settings.impl.AddressSettings) Configuration(org.apache.activemq.artemis.core.config.Configuration) ClusterConnectionConfiguration(org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) ArrayList(java.util.ArrayList) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) InVMConnectorFactory(org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory)

Example 12 with ClusterConnectionConfiguration

use of org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration in project activemq-artemis by apache.

the class ClusterConnectionConfigurationTest method testClusterConnectionStatic.

@Test
public void testClusterConnectionStatic() throws Exception {
    ClusterConnectionConfigurationParser parser = new ClusterConnectionConfigurationParser();
    ClusterConnectionConfiguration configuration = parser.newObject(new URI("static:(tcp://localhost:6556,tcp://localhost:6557)?minLargeMessageSize=132;s&messageLoadBalancingType=OFF"), null);
    Assert.assertEquals(MessageLoadBalancingType.OFF, configuration.getMessageLoadBalancingType());
    Assert.assertEquals(132, configuration.getMinLargeMessageSize());
    Assert.assertEquals("tcp://localhost:6556", configuration.getCompositeMembers().getComponents()[0].toString());
    Assert.assertEquals("tcp://localhost:6557", configuration.getCompositeMembers().getComponents()[1].toString());
}
Also used : ClusterConnectionConfiguration(org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration) URI(java.net.URI) Test(org.junit.Test)

Example 13 with ClusterConnectionConfiguration

use of org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration in project activemq-artemis by apache.

the class ReplicationTest method testClusterConnectionConfigs.

@Test
public void testClusterConnectionConfigs() throws Exception {
    final long ttlOverride = 123456789;
    final long checkPeriodOverride = 987654321;
    ExtraConfigurer configurer = new ExtraConfigurer() {

        @Override
        public void config(Configuration liveConfig, Configuration backupConfig) {
            List<ClusterConnectionConfiguration> ccList = backupConfig.getClusterConfigurations();
            assertTrue(ccList.size() > 0);
            ClusterConnectionConfiguration cc = ccList.get(0);
            cc.setConnectionTTL(ttlOverride);
            cc.setClientFailureCheckPeriod(checkPeriodOverride);
        }
    };
    this.setupServer(true, true, configurer);
    assertTrue(backupServer instanceof ActiveMQServerImpl);
    ClusterController controller = backupServer.getClusterManager().getClusterController();
    ServerLocator replicationLocator = controller.getReplicationLocator();
    assertNotNull(replicationLocator);
    assertEquals(ttlOverride, replicationLocator.getConnectionTTL());
    assertEquals(checkPeriodOverride, replicationLocator.getClientFailureCheckPeriod());
}
Also used : ClusterConnectionConfiguration(org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration) ClusterController(org.apache.activemq.artemis.core.server.cluster.ClusterController) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) Configuration(org.apache.activemq.artemis.core.config.Configuration) ActiveMQDefaultConfiguration(org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration) ClusterConnectionConfiguration(org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration) SharedStoreSlavePolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration) ActiveMQServerImpl(org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl) ServerLocator(org.apache.activemq.artemis.api.core.client.ServerLocator) Test(org.junit.Test)

Example 14 with ClusterConnectionConfiguration

use of org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration in project activemq-artemis by apache.

the class SharedNothingReplicationTest method createLiveConfiguration.

private Configuration createLiveConfiguration() throws Exception {
    Configuration conf = new ConfigurationImpl();
    conf.setName("localhost::live");
    File liveDir = brokersFolder.newFolder("live");
    conf.setBrokerInstance(liveDir);
    conf.addAcceptorConfiguration("live", "tcp://localhost:61616");
    conf.addConnectorConfiguration("backup", "tcp://localhost:61617");
    conf.addConnectorConfiguration("live", "tcp://localhost:61616");
    conf.setClusterUser("mycluster");
    conf.setClusterPassword("mypassword");
    ReplicatedPolicyConfiguration haPolicy = new ReplicatedPolicyConfiguration();
    haPolicy.setVoteOnReplicationFailure(false);
    haPolicy.setCheckForLiveServer(false);
    conf.setHAPolicyConfiguration(haPolicy);
    ClusterConnectionConfiguration ccconf = new ClusterConnectionConfiguration();
    ccconf.setStaticConnectors(new ArrayList<>()).getStaticConnectors().add("backup");
    ccconf.setName("cluster");
    ccconf.setConnectorName("live");
    conf.addClusterConfiguration(ccconf);
    conf.setSecurityEnabled(false).setJMXManagementEnabled(false).setJournalType(JournalType.MAPPED).setJournalFileSize(1024 * 512).setConnectionTTLOverride(60_000L);
    return conf;
}
Also used : ClusterConnectionConfiguration(org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration) Configuration(org.apache.activemq.artemis.core.config.Configuration) ClusterConnectionConfiguration(org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration) ReplicatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration) ReplicaPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration) ReplicatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration) ConfigurationImpl(org.apache.activemq.artemis.core.config.impl.ConfigurationImpl) File(java.io.File)

Example 15 with ClusterConnectionConfiguration

use of org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration in project activemq-artemis by apache.

the class SharedNothingReplicationTest method createBackupConfiguration.

private Configuration createBackupConfiguration() throws Exception {
    Configuration conf = new ConfigurationImpl();
    conf.setName("localhost::backup");
    File backupDir = brokersFolder.newFolder("backup");
    conf.setBrokerInstance(backupDir);
    ReplicaPolicyConfiguration haPolicy = new ReplicaPolicyConfiguration();
    haPolicy.setClusterName("cluster");
    conf.setHAPolicyConfiguration(haPolicy);
    conf.addAcceptorConfiguration("backup", "tcp://localhost:61617");
    conf.addConnectorConfiguration("live", "tcp://localhost:61616");
    conf.addConnectorConfiguration("backup", "tcp://localhost:61617");
    conf.setClusterUser("mycluster");
    conf.setClusterPassword("mypassword");
    ClusterConnectionConfiguration ccconf = new ClusterConnectionConfiguration();
    ccconf.setStaticConnectors(new ArrayList<>()).getStaticConnectors().add("live");
    ccconf.setName("cluster");
    ccconf.setConnectorName("backup");
    conf.addClusterConfiguration(ccconf);
    conf.setSecurityEnabled(false).setJMXManagementEnabled(false).setJournalType(JournalType.MAPPED).setJournalFileSize(1024 * 512).setConnectionTTLOverride(60_000L);
    return conf;
}
Also used : ClusterConnectionConfiguration(org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration) Configuration(org.apache.activemq.artemis.core.config.Configuration) ClusterConnectionConfiguration(org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration) ReplicatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration) ReplicaPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration) ReplicaPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration) ConfigurationImpl(org.apache.activemq.artemis.core.config.impl.ConfigurationImpl) File(java.io.File)

Aggregations

ClusterConnectionConfiguration (org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration)36 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)18 Configuration (org.apache.activemq.artemis.core.config.Configuration)18 ArrayList (java.util.ArrayList)12 ReplicaPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration)11 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)10 ReplicatedPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration)10 SharedStoreSlavePolicyConfiguration (org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration)10 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)10 DiscoveryGroupConfiguration (org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration)9 SharedStoreMasterPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration)9 BroadcastGroupConfiguration (org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration)8 Test (org.junit.Test)8 URI (java.net.URI)7 ActiveMQDefaultConfiguration (org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration)7 HAPolicyConfiguration (org.apache.activemq.artemis.core.config.HAPolicyConfiguration)7 LiveOnlyPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration)7 GroupingHandlerConfiguration (org.apache.activemq.artemis.core.server.group.impl.GroupingHandlerConfiguration)6 HashMap (java.util.HashMap)4 UDPBroadcastEndpointFactory (org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory)3