Search in sources :

Example 16 with ReplicatedPolicyConfiguration

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

the class ClusterTestBase method setupLiveServer.

protected void setupLiveServer(final int node, final boolean fileStorage, final boolean sharedStorage, final boolean netty, boolean liveOnly) throws Exception {
    if (servers[node] != null) {
        throw new IllegalArgumentException("Already a server at node " + node);
    }
    HAPolicyConfiguration haPolicyConfiguration = null;
    if (liveOnly) {
        haPolicyConfiguration = new LiveOnlyPolicyConfiguration();
    } else {
        if (sharedStorage)
            haPolicyConfiguration = new SharedStoreMasterPolicyConfiguration();
        else
            haPolicyConfiguration = new ReplicatedPolicyConfiguration();
    }
    Configuration configuration = createBasicConfig(node).setJournalMaxIO_AIO(1000).setThreadPoolMaxSize(10).clearAcceptorConfigurations().addAcceptorConfiguration(createTransportConfiguration(netty, true, generateParams(node, netty))).setHAPolicyConfiguration(haPolicyConfiguration).setResolveProtocols(isResolveProtocols());
    ActiveMQServer server;
    if (fileStorage) {
        if (sharedStorage) {
            server = createInVMFailoverServer(true, configuration, nodeManagers[node], node);
        } else {
            server = createServer(configuration);
        }
    } else {
        if (sharedStorage) {
            server = createInVMFailoverServer(false, configuration, nodeManagers[node], node);
        } else {
            server = createServer(false, configuration);
        }
    }
    server.addProtocolManagerFactory(new CoreProtocolManagerFactory());
    server.setIdentity(this.getClass().getSimpleName() + "/Live(" + node + ")");
    servers[node] = addServer(server);
}
Also used : HAPolicyConfiguration(org.apache.activemq.artemis.core.config.HAPolicyConfiguration) LiveOnlyPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration) ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) GroupingHandlerConfiguration(org.apache.activemq.artemis.core.server.group.impl.GroupingHandlerConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) Configuration(org.apache.activemq.artemis.core.config.Configuration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) ActiveMQDefaultConfiguration(org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration) ClusterConnectionConfiguration(org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration) LiveOnlyPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration) ReplicatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration) ReplicaPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration) SharedStoreSlavePolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration) DiscoveryGroupConfiguration(org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration) HAPolicyConfiguration(org.apache.activemq.artemis.core.config.HAPolicyConfiguration) BroadcastGroupConfiguration(org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration) ReplicatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) CoreProtocolManagerFactory(org.apache.activemq.artemis.core.protocol.core.impl.CoreProtocolManagerFactory)

Example 17 with ReplicatedPolicyConfiguration

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

the class ClusterTestBase method setupLiveServerWithDiscovery.

protected void setupLiveServerWithDiscovery(final int node, final String groupAddress, final int port, final boolean fileStorage, final boolean netty, final boolean sharedStorage) throws Exception {
    if (servers[node] != null) {
        throw new IllegalArgumentException("Already a server at node " + node);
    }
    Map<String, Object> params = generateParams(node, netty);
    TransportConfiguration connector = createTransportConfiguration(netty, false, params);
    List<String> connectorPairs = new ArrayList<>();
    connectorPairs.add(connector.getName());
    UDPBroadcastEndpointFactory endpoint = new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(port);
    BroadcastGroupConfiguration bcConfig = new BroadcastGroupConfiguration().setName("bg1").setBroadcastPeriod(200).setConnectorInfos(connectorPairs).setEndpointFactory(endpoint);
    DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration().setName("dg1").setRefreshTimeout(1000).setDiscoveryInitialWaitTimeout(1000).setBroadcastEndpointFactory(endpoint);
    Configuration configuration = createBasicConfig(node).setJournalMaxIO_AIO(1000).clearAcceptorConfigurations().addAcceptorConfiguration(createTransportConfiguration(netty, true, params)).addConnectorConfiguration(connector.getName(), connector).addBroadcastGroupConfiguration(bcConfig).addDiscoveryGroupConfiguration(dcConfig.getName(), dcConfig).setHAPolicyConfiguration(sharedStorage ? new SharedStoreMasterPolicyConfiguration() : new ReplicatedPolicyConfiguration());
    ActiveMQServer server;
    if (fileStorage) {
        if (sharedStorage) {
            server = createInVMFailoverServer(true, configuration, nodeManagers[node], node);
        } else {
            server = addServer(ActiveMQServers.newActiveMQServer(configuration));
            server.setIdentity("Server " + node);
        }
    } else {
        if (sharedStorage) {
            server = createInVMFailoverServer(false, configuration, nodeManagers[node], node);
        } else {
            server = addServer(ActiveMQServers.newActiveMQServer(configuration, false));
            server.setIdentity("Server " + node);
        }
    }
    servers[node] = server;
}
Also used : GroupingHandlerConfiguration(org.apache.activemq.artemis.core.server.group.impl.GroupingHandlerConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) Configuration(org.apache.activemq.artemis.core.config.Configuration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) ActiveMQDefaultConfiguration(org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration) ClusterConnectionConfiguration(org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration) LiveOnlyPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration) ReplicatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration) ReplicaPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration) SharedStoreSlavePolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration) DiscoveryGroupConfiguration(org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration) HAPolicyConfiguration(org.apache.activemq.artemis.core.config.HAPolicyConfiguration) BroadcastGroupConfiguration(org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration) ArrayList(java.util.ArrayList) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) DiscoveryGroupConfiguration(org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration) ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) ReplicatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration) UDPBroadcastEndpointFactory(org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory) BroadcastGroupConfiguration(org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration)

Aggregations

ReplicatedPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration)17 ReplicaPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration)12 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)10 Configuration (org.apache.activemq.artemis.core.config.Configuration)10 SharedStoreMasterPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration)10 SharedStoreSlavePolicyConfiguration (org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration)10 ArrayList (java.util.ArrayList)5 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)5 ClusterConnectionConfiguration (org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration)5 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)5 HAPolicyConfiguration (org.apache.activemq.artemis.core.config.HAPolicyConfiguration)4 SameProcessActiveMQServer (org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer)4 ActiveMQDefaultConfiguration (org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration)3 BroadcastGroupConfiguration (org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration)3 DiscoveryGroupConfiguration (org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration)3 LiveOnlyPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration)3 GroupingHandlerConfiguration (org.apache.activemq.artemis.core.server.group.impl.GroupingHandlerConfiguration)3 Test (org.junit.Test)3 UDPBroadcastEndpointFactory (org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory)2 NodeManager (org.apache.activemq.artemis.core.server.NodeManager)2