Beispiel #1
0
  protected static Configuration createDefaultConfig(
      final Map<String, Object> params, final String... acceptors) {
    Configuration configuration = new ConfigurationImpl();
    configuration.setSecurityEnabled(false);
    configuration.setJMXManagementEnabled(false);
    configuration.setBindingsDirectory(getBindingsDir());
    configuration.setJournalMinFiles(2);
    configuration.setJournalDirectory(getJournalDir());
    configuration.setJournalFileSize(100 * 1024);
    configuration.setPagingDirectory(getPageDir());
    configuration.setLargeMessagesDirectory(getLargeMessagesDir());
    configuration.setJournalCompactMinFiles(0);
    configuration.setJournalCompactPercentage(0);

    configuration.setFileDeploymentEnabled(false);

    configuration.setJournalType(getDefaultJournalType());

    configuration.getAcceptorConfigurations().clear();

    for (String acceptor : acceptors) {
      TransportConfiguration transportConfig = new TransportConfiguration(acceptor, params);
      configuration.getAcceptorConfigurations().add(transportConfig);
    }

    return configuration;
  }
Beispiel #2
0
  /** @throws Exception */
  protected void initServer() throws Exception {
    configuration = createDefaultConfig();
    configuration.setSecurityEnabled(false);
    configuration.setJournalMinFiles(2);
    server = createServer(true, configuration);
    server.start();

    AddressSettings qs = server.getAddressSettingsRepository().getMatch("*");
    AddressSettings newSets = new AddressSettings();
    newSets.setRedeliveryDelay(DelayedMessageTest.DELAY);
    newSets.merge(qs);
    server.getAddressSettingsRepository().addMatch(qName, newSets);
    locator = createInVMNonHALocator();
  }
Beispiel #3
0
  protected void startServer() throws Exception {
    Configuration config = createDefaultConfig();
    config.setJournalFileSize(HornetQDefaultConfiguration.DEFAULT_JOURNAL_FILE_SIZE);
    config.setJournalCompactMinFiles(HornetQDefaultConfiguration.DEFAULT_JOURNAL_COMPACT_MIN_FILES);
    config.setJournalCompactPercentage(
        HornetQDefaultConfiguration.DEFAULT_JOURNAL_COMPACT_PERCENTAGE);
    config.setJournalMinFiles(2);

    server = super.createServer(true, config);

    server.start();
    locator = createInVMNonHALocator();
    factory = createSessionFactory(locator);
  }
Beispiel #4
0
  protected void startServer() throws Exception {
    Configuration config = createDefaultConfig();
    config.setJournalFileSize(HornetQDefaultConfiguration.getDefaultJournalFileSize());
    config.setJournalCompactMinFiles(
        HornetQDefaultConfiguration.getDefaultJournalCompactMinFiles());
    config.setJournalCompactPercentage(
        HornetQDefaultConfiguration.getDefaultJournalCompactPercentage());
    config.setJournalMinFiles(2);

    server = super.createServer(true, config);

    server.start();
    locator = createInVMNonHALocator();
    factory = createSessionFactory(locator);
  }
  /** @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);

    backupConf = createBasicConfig(0);

    backupConf.getAcceptorConfigurations().add(backupAcceptortc);
    backupConf.getConnectorConfigurations().put(livetc.getName(), livetc);
    backupConf.getConnectorConfigurations().put(backuptc.getName(), backuptc);
    basicClusterConnectionConfig(backupConf, backuptc.getName(), livetc.getName());

    backupConf.setSecurityEnabled(false);
    backupConf.setJournalType(getDefaultJournalType());
    backupParams.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
    backupConf
        .getAcceptorConfigurations()
        .add(new TransportConfiguration(INVM_ACCEPTOR_FACTORY, backupParams));
    backupConf.setBackup(true);
    backupConf.setSharedStore(true);
    backupConf.setBindingsDirectory(getBindingsDir());
    backupConf.setJournalMinFiles(2);
    backupConf.setJournalDirectory(getJournalDir());
    backupConf.setPagingDirectory(getPageDir());
    backupConf.setLargeMessagesDirectory(getLargeMessagesDir());
    backupConf.setPersistenceEnabled(true);
    backupService = new InVMNodeManagerServer(backupConf, nodeManager);

    backupJMSService = new JMSServerManagerImpl(backupService);

    backupJMSService.setContext(ctx2);

    backupJMSService.getHornetQServer().setIdentity("JMSBackup");
    log.info("Starting backup");
    backupJMSService.start();

    liveConf = createBasicConfig(0);

    liveConf.setJournalDirectory(getJournalDir());
    liveConf.setBindingsDirectory(getBindingsDir());

    liveConf.setSecurityEnabled(false);
    liveConf.getAcceptorConfigurations().add(liveAcceptortc);
    basicClusterConnectionConfig(liveConf, livetc.getName());
    liveConf.setSharedStore(true);
    liveConf.setJournalType(getDefaultJournalType());
    liveConf.setBindingsDirectory(getBindingsDir());
    liveConf.setJournalMinFiles(2);
    liveConf.setJournalDirectory(getJournalDir());
    liveConf.setPagingDirectory(getPageDir());
    liveConf.setLargeMessagesDirectory(getLargeMessagesDir());
    liveConf.getConnectorConfigurations().put(livetc.getName(), livetc);
    liveConf.setPersistenceEnabled(true);
    liveService = new InVMNodeManagerServer(liveConf, nodeManager);

    liveJMSService = new JMSServerManagerImpl(liveService);

    liveJMSService.setContext(ctx1);

    liveJMSService.getHornetQServer().setIdentity("JMSLive");
    log.info("Starting life");

    liveJMSService.start();

    JMSUtil.waitForServer(backupService);
  }