Search in sources :

Example 1 with InVMNodeManagerServer

use of org.apache.activemq.artemis.tests.util.InVMNodeManagerServer 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 2 with InVMNodeManagerServer

use of org.apache.activemq.artemis.tests.util.InVMNodeManagerServer in project activemq-artemis by apache.

the class BridgeTestBase method createActiveMQServer.

protected ActiveMQServer createActiveMQServer(final int id, final Map<String, Object> params, final boolean netty, final NodeManager nodeManager) throws Exception {
    TransportConfiguration tc = new TransportConfiguration();
    if (netty) {
        params.put(org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME, org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.DEFAULT_PORT + id);
        tc = new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params);
    } else {
        params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, id);
        tc = new TransportConfiguration(INVM_ACCEPTOR_FACTORY, params);
    }
    Configuration serviceConf = createBasicConfig().setJournalType(getDefaultJournalType()).setBindingsDirectory(getBindingsDir(id, false)).setJournalMinFiles(2).setJournalDirectory(getJournalDir(id, false)).setPagingDirectory(getPageDir(id, false)).setLargeMessagesDirectory(getLargeMessagesDir(id, false)).setJournalFileSize(100 * 1024).addAcceptorConfiguration(tc).setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration());
    ActiveMQServer server;
    if (nodeManager == null) {
        server = ActiveMQServers.newActiveMQServer(serviceConf, true);
    } else {
        server = new InVMNodeManagerServer(serviceConf, nodeManager);
    }
    return addServer(server);
}
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) SharedStoreSlavePolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) InVMNodeManagerServer(org.apache.activemq.artemis.tests.util.InVMNodeManagerServer) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration)

Example 3 with InVMNodeManagerServer

use of org.apache.activemq.artemis.tests.util.InVMNodeManagerServer in project activemq-artemis by apache.

the class BridgeTestBase method createBackupActiveMQServer.

protected ActiveMQServer createBackupActiveMQServer(final int id, final Map<String, Object> params, final boolean netty, final int liveId, final NodeManager nodeManager) throws Exception {
    TransportConfiguration tc = new TransportConfiguration();
    if (netty) {
        params.put(org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME, org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.DEFAULT_PORT + id);
        tc = new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params);
    } else {
        params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, id);
        tc = new TransportConfiguration(INVM_ACCEPTOR_FACTORY, params);
    }
    Configuration serviceConf = createBasicConfig().setJournalType(getDefaultJournalType()).setBindingsDirectory(getBindingsDir(liveId, false)).setJournalMinFiles(2).setJournalDirectory(getJournalDir(liveId, false)).setPagingDirectory(getPageDir(liveId, false)).setLargeMessagesDirectory(getLargeMessagesDir(liveId, false)).setJournalFileSize(100 * 1024).addAcceptorConfiguration(tc).setHAPolicyConfiguration(new SharedStoreSlavePolicyConfiguration());
    ActiveMQServer server;
    if (nodeManager == null) {
        server = ActiveMQServers.newActiveMQServer(serviceConf, true);
    } else {
        server = new InVMNodeManagerServer(serviceConf, nodeManager);
    }
    return addServer(server);
}
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) SharedStoreSlavePolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) SharedStoreSlavePolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration) InVMNodeManagerServer(org.apache.activemq.artemis.tests.util.InVMNodeManagerServer) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration)

Example 4 with InVMNodeManagerServer

use of org.apache.activemq.artemis.tests.util.InVMNodeManagerServer in project activemq-artemis by apache.

the class JMSFailoverListenerTest method startServers.

/**
 * @throws Exception
 */
protected void startServers() throws Exception {
    NodeManager nodeManager = new InVMNodeManager(false);
    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).setJournalType(getDefaultJournalType()).addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY, backupParams)).setBindingsDirectory(getBindingsDir()).setJournalMinFiles(2).setJournalDirectory(getJournalDir()).setPagingDirectory(getPageDir()).setLargeMessagesDirectory(getLargeMessagesDir()).setPersistenceEnabled(true).setHAPolicyConfiguration(new SharedStoreSlavePolicyConfiguration()).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()).addAcceptorConfiguration(liveAcceptortc).setJournalType(getDefaultJournalType()).setBindingsDirectory(getBindingsDir()).setJournalMinFiles(2).setJournalDirectory(getJournalDir()).setPagingDirectory(getPageDir()).setLargeMessagesDirectory(getLargeMessagesDir()).addConnectorConfiguration(livetc.getName(), livetc).setPersistenceEnabled(true).setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration()).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) 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)

Aggregations

TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)4 SharedStoreMasterPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration)4 SharedStoreSlavePolicyConfiguration (org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration)4 InVMNodeManagerServer (org.apache.activemq.artemis.tests.util.InVMNodeManagerServer)4 Configuration (org.apache.activemq.artemis.core.config.Configuration)2 JndiBindingRegistry (org.apache.activemq.artemis.core.registry.JndiBindingRegistry)2 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)2 NodeManager (org.apache.activemq.artemis.core.server.NodeManager)2 InVMNodeManager (org.apache.activemq.artemis.core.server.impl.InVMNodeManager)2 JMSServerManagerImpl (org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl)2 ReplicaPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration)1 ReplicatedPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration)1