/**
*
* Copyright 2004 Protique Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**/
package org.activemq.broker.impl;
import org.activemq.ActiveMQConnection;
import org.activemq.broker.BrokerContainer;
import javax.jms.JMSException;
/**
* A simple command line tool which runs a JMS Message Broker on the command line
*
* @version $Revision: 1.1.1.1 $
*/
public class Main {
/**
* run the Message Broker as a standalone application
*
* @param args
*/
public static void main(String args[]) {
try {
String url = ActiveMQConnection.DEFAULT_BROKER_URL;
if (args.length > 0) {
url = args[0];
}
BrokerContainer container = new BrokerContainerImpl();
container.addConnector(url);
if (args.length > 1) {
container.addNetworkConnector(args[1]);
}
container.start();
// lets wait until we're killed.
Object lock = new Object();
synchronized (lock) {
lock.wait();
}
}
catch (JMSException e) {
System.out.println("Caught: " + e);
e.printStackTrace();
Exception le = e.getLinkedException();
System.out.println("Reason: " + le);
if (le != null) {
le.printStackTrace();
}
}
catch (Exception e) {
System.out.println("Caught: " + e);
e.printStackTrace();
}
}
}