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;
}
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);
}
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);
}
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);
}
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();
}
Aggregations