Search in sources :

Example 1 with SharedStoreMasterPolicyConfiguration

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

the class FileConfigurationParser method createSharedStoreMasterHaPolicy.

private SharedStoreMasterPolicyConfiguration createSharedStoreMasterHaPolicy(Element policyNode) {
    SharedStoreMasterPolicyConfiguration configuration = new SharedStoreMasterPolicyConfiguration();
    configuration.setFailoverOnServerShutdown(getBoolean(policyNode, "failover-on-shutdown", configuration.isFailoverOnServerShutdown()));
    configuration.setWaitForActivation(getBoolean(policyNode, "wait-for-activation", configuration.isWaitForActivation()));
    return configuration;
}
Also used : SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration)

Example 2 with SharedStoreMasterPolicyConfiguration

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

the class SecurityFailoverTest method createConfigs.

/**
 * @throws Exception
 */
@Override
protected void createConfigs() throws Exception {
    nodeManager = new InVMNodeManager(false);
    TransportConfiguration liveConnector = getConnectorTransportConfiguration(true);
    TransportConfiguration backupConnector = getConnectorTransportConfiguration(false);
    backupConfig = super.createDefaultInVMConfig().clearAcceptorConfigurations().addAcceptorConfiguration(getAcceptorTransportConfiguration(false)).setSecurityEnabled(true).setHAPolicyConfiguration(new SharedStoreSlavePolicyConfiguration()).addConnectorConfiguration(liveConnector.getName(), liveConnector).addConnectorConfiguration(backupConnector.getName(), backupConnector).addClusterConfiguration(basicClusterConnectionConfig(backupConnector.getName(), liveConnector.getName()));
    backupServer = createTestableServer(backupConfig);
    ActiveMQJAASSecurityManager securityManager = installSecurity(backupServer);
    securityManager.getConfiguration().setDefaultUser(null);
    liveConfig = super.createDefaultInVMConfig().clearAcceptorConfigurations().addAcceptorConfiguration(getAcceptorTransportConfiguration(true)).setSecurityEnabled(true).setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration()).addClusterConfiguration(basicClusterConnectionConfig(liveConnector.getName())).addConnectorConfiguration(liveConnector.getName(), liveConnector);
    liveServer = createTestableServer(liveConfig);
    installSecurity(liveServer);
}
Also used : InVMNodeManager(org.apache.activemq.artemis.core.server.impl.InVMNodeManager) SharedStoreSlavePolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration) ActiveMQJAASSecurityManager(org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration)

Example 3 with SharedStoreMasterPolicyConfiguration

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

the class SharedStoreDontWaitForActivationTest method setupSharedStoreMasterPolicy.

private void setupSharedStoreMasterPolicy(int node) {
    ActiveMQServer server = getServer(node);
    SharedStoreMasterPolicyConfiguration liveConfiguration = new SharedStoreMasterPolicyConfiguration();
    liveConfiguration.setFailoverOnServerShutdown(true);
    liveConfiguration.setWaitForActivation(false);
    Configuration config = server.getConfiguration();
    config.setHAPolicyConfiguration(liveConfiguration);
}
Also used : ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) Configuration(org.apache.activemq.artemis.core.config.Configuration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration)

Example 4 with SharedStoreMasterPolicyConfiguration

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

the class JMSFailoverTest method startServers.

/**
 * @throws Exception
 */
protected void startServers() throws Exception {
    final boolean sharedStore = true;
    NodeManager nodeManager = new InVMNodeManager(!sharedStore);
    backuptc = new TransportConfiguration(INVM_CONNECTOR_FACTORY, backupParams);
    livetc = new TransportConfiguration(INVM_CONNECTOR_FACTORY);
    liveAcceptortc = new TransportConfiguration(INVM_ACCEPTOR_FACTORY);
    backupAcceptortc = new TransportConfiguration(INVM_ACCEPTOR_FACTORY, backupParams);
    backupParams.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
    backupConf = createBasicConfig().addAcceptorConfiguration(backupAcceptortc).addConnectorConfiguration(livetc.getName(), livetc).addConnectorConfiguration(backuptc.getName(), backuptc).setSecurityEnabled(false).setJournalType(getDefaultJournalType()).addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY, backupParams)).setBindingsDirectory(getBindingsDir()).setJournalMinFiles(2).setJournalDirectory(getJournalDir()).setPagingDirectory(getPageDir()).setLargeMessagesDirectory(getLargeMessagesDir()).setPersistenceEnabled(true).setHAPolicyConfiguration(sharedStore ? new SharedStoreSlavePolicyConfiguration() : new ReplicaPolicyConfiguration()).addClusterConfiguration(basicClusterConnectionConfig(backuptc.getName(), livetc.getName()));
    backupServer = addServer(new InVMNodeManagerServer(backupConf, nodeManager));
    backupJMSServer = new JMSServerManagerImpl(backupServer);
    backupJMSServer.setRegistry(new JndiBindingRegistry(ctx2));
    backupJMSServer.getActiveMQServer().setIdentity("JMSBackup");
    log.info("Starting backup");
    backupJMSServer.start();
    liveConf = createBasicConfig().setJournalDirectory(getJournalDir()).setBindingsDirectory(getBindingsDir()).setSecurityEnabled(false).addAcceptorConfiguration(liveAcceptortc).setJournalType(getDefaultJournalType()).setBindingsDirectory(getBindingsDir()).setJournalMinFiles(2).setJournalDirectory(getJournalDir()).setPagingDirectory(getPageDir()).setLargeMessagesDirectory(getLargeMessagesDir()).addConnectorConfiguration(livetc.getName(), livetc).setPersistenceEnabled(true).setHAPolicyConfiguration(sharedStore ? new SharedStoreMasterPolicyConfiguration() : new ReplicatedPolicyConfiguration()).addClusterConfiguration(basicClusterConnectionConfig(livetc.getName()));
    liveServer = addServer(new InVMNodeManagerServer(liveConf, nodeManager));
    liveJMSServer = new JMSServerManagerImpl(liveServer);
    liveJMSServer.setRegistry(new JndiBindingRegistry(ctx1));
    liveJMSServer.getActiveMQServer().setIdentity("JMSLive");
    log.info("Starting life");
    liveJMSServer.start();
    JMSUtil.waitForServer(backupServer);
}
Also used : InVMNodeManager(org.apache.activemq.artemis.core.server.impl.InVMNodeManager) NodeManager(org.apache.activemq.artemis.core.server.NodeManager) InVMNodeManager(org.apache.activemq.artemis.core.server.impl.InVMNodeManager) SharedStoreSlavePolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration) JMSServerManagerImpl(org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl) ReplicatedPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration) InVMNodeManagerServer(org.apache.activemq.artemis.tests.util.InVMNodeManagerServer) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) JndiBindingRegistry(org.apache.activemq.artemis.core.registry.JndiBindingRegistry) ReplicaPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration)

Example 5 with SharedStoreMasterPolicyConfiguration

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

the class SessionFactoryTest method startServer.

private void startServer() throws Exception {
    liveTC = new TransportConfiguration(INVM_CONNECTOR_FACTORY);
    final long broadcastPeriod = 250;
    final String bcGroupName = "bc1";
    final int localBindPort = 5432;
    BroadcastGroupConfiguration broadcastGroupConfiguration = new BroadcastGroupConfiguration().setName(bcGroupName).setBroadcastPeriod(broadcastPeriod).setConnectorInfos(Arrays.asList(liveTC.getName())).setEndpointFactory(new UDPBroadcastEndpointFactory().setGroupAddress(getUDPDiscoveryAddress()).setGroupPort(getUDPDiscoveryPort()).setLocalBindPort(localBindPort));
    Configuration liveConf = createDefaultInVMConfig().addConnectorConfiguration(liveTC.getName(), liveTC).setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration()).addBroadcastGroupConfiguration(broadcastGroupConfiguration);
    liveService = createServer(false, liveConf);
    liveService.start();
}
Also used : Configuration(org.apache.activemq.artemis.core.config.Configuration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) DiscoveryGroupConfiguration(org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration) BroadcastGroupConfiguration(org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) BroadcastGroupConfiguration(org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration) UDPBroadcastEndpointFactory(org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory)

Aggregations

SharedStoreMasterPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration)27 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)21 SharedStoreSlavePolicyConfiguration (org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration)20 Configuration (org.apache.activemq.artemis.core.config.Configuration)16 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)9 InVMNodeManager (org.apache.activemq.artemis.core.server.impl.InVMNodeManager)9 ReplicatedPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration)8 ReplicaPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration)7 ArrayList (java.util.ArrayList)6 HAPolicyConfiguration (org.apache.activemq.artemis.core.config.HAPolicyConfiguration)6 BroadcastGroupConfiguration (org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration)5 DiscoveryGroupConfiguration (org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration)5 ActiveMQDefaultConfiguration (org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration)4 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)4 UDPBroadcastEndpointFactory (org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory)4 ClusterConnectionConfiguration (org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration)4 ScaleDownConfiguration (org.apache.activemq.artemis.core.config.ScaleDownConfiguration)3 ColocatedPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration)3 JndiBindingRegistry (org.apache.activemq.artemis.core.registry.JndiBindingRegistry)3 NodeManager (org.apache.activemq.artemis.core.server.NodeManager)3