@Before
  public void before() throws Exception {
    if (System.getProperty(java_security_auth_login_config) != null) {
      oldLoginConf = System.getProperty(java_security_auth_login_config);
    }
    System.setProperty(java_security_auth_login_config, base + "/" + conf + "/" + "login.config");
    broker1 = BrokerFactory.createBroker(xbean + base + "/" + conf + "/" + JaasStompSSLBroker1_xml);
    broker2 = BrokerFactory.createBroker(xbean + base + "/" + conf + "/" + JaasStompSSLBroker2_xml);

    broker1.start();
    broker1.waitUntilStarted();
    broker2.start();
    broker2.waitUntilStarted();
  }
示例#2
0
 public static BrokerService createBroker(String name) throws Exception {
   BrokerService b =
       BrokerFactory.createBroker("xbean:META-INF/org/apache/activemq/" + name + ".xml");
   if (!name.equals(b.getBrokerName())) {
     LOG.warn("Broker name mismatch (expecting '{}'). Check configuration.", name);
     return null;
   }
   BROKERS.add(b);
   b.start();
   b.waitUntilStarted();
   LOG.info("Broker '{}' started.", name);
   return b;
 }
  public static void main(String[] args) throws Exception {
    System.setProperty("activemq.base", System.getProperty("user.dir"));
    BrokerService broker =
        BrokerFactory.createBroker(
            new URI("xbean:target/classes/org/apache/activemq/book/ch7/activemq-simple.xml"));
    broker.start();

    System.out.println();
    System.out.println("Press any key to stop the broker");
    System.out.println();

    System.in.read();
  }
  // set up broker with https first...
  @Override
  protected void setUp() throws Exception {
    broker = BrokerFactory.createBroker("xbean:activemq-https-want-client-auth.xml");
    broker.setPersistent(false);
    broker.start();
    broker.waitUntilStarted();

    // these are used for the client side... for the server side, the SSL context
    // will be configured through the <sslContext> spring beans
    System.setProperty("javax.net.ssl.trustStore", TRUST_KEYSTORE);
    System.setProperty("javax.net.ssl.trustStorePassword", PASSWORD);
    System.setProperty("javax.net.ssl.trustStoreType", KEYSTORE_TYPE);
    //        System.setProperty("javax.net.ssl.keyStore", KEYSTORE);
    //        System.setProperty("javax.net.ssl.keyStorePassword", PASSWORD);
    //        System.setProperty("javax.net.ssl.keyStoreType", KEYSTORE_TYPE);
    super.setUp();
  }
  /** Setup broker with VirtualTopic configured */
  private void setupBroker(String uri) {
    try {
      broker = BrokerFactory.createBroker(uri);

      VirtualDestinationInterceptor interceptor = new VirtualDestinationInterceptor();
      VirtualTopic virtualTopic = new VirtualTopic();
      virtualTopic.setName("VirtualOrders.>");
      virtualTopic.setSelectorAware(true);
      VirtualDestination[] virtualDestinations = {virtualTopic};
      interceptor.setVirtualDestinations(virtualDestinations);
      broker.setDestinationInterceptors(new DestinationInterceptor[] {interceptor});

      SubQueueSelectorCacheBrokerPlugin subQueueSelectorCacheBrokerPlugin =
          new SubQueueSelectorCacheBrokerPlugin();
      BrokerPlugin[] updatedPlugins = {subQueueSelectorCacheBrokerPlugin};
      broker.setPlugins(updatedPlugins);

      broker.start();
      broker.waitUntilStarted();
    } catch (Exception e) {
      LOG.error("Failed creating broker", e);
    }
  }
 protected BrokerService createBroker(String uri) throws Exception {
   LOG.info("Loading broker configuration from the classpath with URI: " + uri);
   return BrokerFactory.createBroker(new URI("xbean:" + uri));
 }
示例#7
0
 @Override
 protected BrokerService createBroker() throws Exception {
   return BrokerFactory.createBroker(
       new URI("xbean:org/apache/activemq/broker/store/loadtester.xml"));
 }
 protected BrokerService createBroker() throws Exception {
   String uri = "org/apache/activemq/xbean/activemq-policy.xml";
   LOG.info("Loading broker configuration from the classpath with URI: " + uri);
   return BrokerFactory.createBroker(new URI("xbean:" + uri));
 }