## Starting a Broker

### Starting a standalone broker

To start a standalone instance of FUSE Message Broker:

1. In a command prompt or terminal window, change directory to the FUSE Message Broker installation directory.

2. Change directory to the `bin` directory.

3. Type the following:

   - Windows:

     `activemq.bat`

   - UNIX:

     `./activemq`

### Starting an embedded broker

An embedded broker executes within the same JVM process as the clients that are using its services. There are a number of ways to embed a broker. The simplest is shown in Example 3.1

Example 3.1. Starting an Embedded Broker

    BrokerService broker = new BrokerService();
    broker.addConnector("tcp://localhost:61616");
    broker.start();

Clients running in the same VM can connect to the embedded broker using the VM transport connector; external clients connect using the TCP transport connector.

If you have more than one broker running in the same VM, you need to set the broker name, as shown in Example 3.2:

Example 3.2. Starting a Named Embedded Broker

    BrokerService broker = new BrokerService();
    broker.setBrokerName("broker1");
    broker.addConnector("tcp://localhost:61616");
    broker.start();

Clients or other brokers connecting from within the same VM can use the URI `vm://broker1`.