예제 #1
0
 private void configureAcceptor() {
   config.setPersistenceEnabled(true);
   config.setSecurityEnabled(false);
   config
       .getAcceptorConfigurations()
       .add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
   config
       .getConnectorConfigurations()
       .put("connector", new TransportConfiguration(InVMConnectorFactory.class.getName()));
 }
  @BeforeClass
  public static void setup() throws Exception {
    Configuration configuration = new ConfigurationImpl();
    configuration.setPersistenceEnabled(false);
    configuration.setSecurityEnabled(false);
    configuration
        .getAcceptorConfigurations()
        .add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));

    server = HornetQServers.newHornetQServer(configuration);
    server.start();
  }
예제 #3
0
  /**
   * @param toOtherServerPair
   * @throws Exception
   */
  private void setupServer1() throws Exception {
    List<String> toOtherServerPair = new ArrayList<String>();
    toOtherServerPair.add("toServer2");

    Configuration conf1 =
        createDefaultConfig(0, generateInVMParams(0), InVMAcceptorFactory.class.getCanonicalName());

    conf1.setSecurityEnabled(false);
    conf1.setJMXManagementEnabled(true);
    conf1.setPersistenceEnabled(false);

    conf1
        .getConnectorConfigurations()
        .put(
            "toServer2",
            new TransportConfiguration(
                InVMConnectorFactory.class.getName(), generateInVMParams(1)));
    conf1
        .getConnectorConfigurations()
        .put(
            "server1",
            new TransportConfiguration(
                InVMConnectorFactory.class.getName(), generateInVMParams(0)));

    conf1.setClustered(true);

    conf1
        .getClusterConfigurations()
        .add(
            new ClusterConnectionConfiguration(
                "to-server2",
                "jms",
                "server1",
                1000,
                true,
                true,
                MAX_HOPS,
                1024,
                toOtherServerPair,
                false));

    JMSConfigurationImpl jmsconfig = new JMSConfigurationImpl();
    // jmsconfig.getTopicConfigurations().add(new TopicConfigurationImpl("t1", "topic/t1"));

    server1 = HornetQServers.newHornetQServer(conf1, false);
    jmsServer1 = new JMSServerManagerImpl(server1, jmsconfig);
    context1 = new InVMContext();
    jmsServer1.setContext(context1);
  }
  private JMSServerManager createJMSServer() throws Exception {
    Configuration conf = createDefaultConfig();
    conf.setSecurityEnabled(false);
    conf.setJMXManagementEnabled(true);
    conf.setPersistenceEnabled(true);
    conf.setJournalType(JournalType.NIO);
    conf.getAcceptorConfigurations()
        .add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
    HornetQServer server = HornetQServers.newHornetQServer(conf, mbeanServer);

    context = new InVMContext();

    serverManager = new JMSServerManagerImpl(server);
    serverManager.setContext(context);
    return serverManager;
  }
예제 #5
0
  @Override
  @Before
  public void setUp() throws Exception {
    super.setUp();

    Configuration config = createDefaultConfig(false);

    config.setMessageExpiryScanPeriod(10);

    HornetQSecurityManager securityManager = new HornetQSecurityManagerImpl();

    config.setPersistenceEnabled(true);

    server =
        new MyHornetQServer(config, ManagementFactory.getPlatformMBeanServer(), securityManager);

    server.start();

    locator = createInVMNonHALocator();
  }
예제 #6
0
  /** @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);
  }