made the test case broker Main a little easier to run with a URI supplied on the command line

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@424326 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2006-07-21 14:07:18 +00:00
parent f8734f79c6
commit e2f0ef3c5e
1 changed files with 16 additions and 12 deletions

View File

@ -17,6 +17,7 @@
package org.apache.activemq.test; package org.apache.activemq.test;
import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerFactory;
import org.apache.activemq.broker.BrokerPlugin; import org.apache.activemq.broker.BrokerPlugin;
import org.apache.activemq.broker.BrokerService; import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.view.ConnectionDotFilePlugin; import org.apache.activemq.broker.view.ConnectionDotFilePlugin;
@ -28,6 +29,8 @@ import javax.jms.Connection;
import javax.jms.MessageConsumer; import javax.jms.MessageConsumer;
import javax.jms.Session; import javax.jms.Session;
import java.net.URI;
/** /**
* A helper class which can be handy for running a broker in your IDE from the * A helper class which can be handy for running a broker in your IDE from the
* activemq-core module. * activemq-core module.
@ -41,19 +44,20 @@ public class Main {
*/ */
public static void main(String[] args) { public static void main(String[] args) {
String brokerURI = "broker:(tcp://localhost:61616,stomp://localhost:61613)?persistent=false&useJmx=true"; String brokerURI = "broker:(tcp://localhost:61616,stomp://localhost:61613)?persistent=false&useJmx=true";
if (args.length > 0) {
brokerURI = args[0];
}
try { try {
// TODO - this seems to break interceptors for some reason BrokerService broker = null;
// BrokerService broker = BrokerFactory.createBroker(new if (args.length > 0) {
// URI(brokerURI)); brokerURI = args[0];
BrokerService broker = new BrokerService(); broker = BrokerFactory.createBroker(new URI(brokerURI));
broker.setPersistent(false); }
broker.setUseJmx(true); else {
broker.setPlugins(new BrokerPlugin[] { /*new DestinationDotFilePlugin(), */ new ConnectionDotFilePlugin() }); broker = new BrokerService();
broker.addConnector("tcp://localhost:61616"); broker.setPersistent(false);
broker.addConnector("stomp://localhost:61613"); broker.setUseJmx(true);
broker.setPlugins(new BrokerPlugin[] { new ConnectionDotFilePlugin() });
broker.addConnector("tcp://localhost:61616");
broker.addConnector("stomp://localhost:61613");
}
broker.start(); broker.start();
// lets create a dummy couple of consumers // lets create a dummy couple of consumers