Contact Us 1-800-596-4880

Alternate Ways of Running Mule

This section describes ways of running Mule other than from the command prompt.

Running Mule From the IDE

  1. Choose File > New > Project, expand the Mule folder and select Mule Project, and then click Next.

  2. Enter a name for the project, ensuring that there is no space in the project name. If you want to put the project in a location other than the default workspace, clear the Use default location check box and specify a new file location.

  3. Click Finish so the Mule IDE will generate your project.

Running Mule Programmatically in Java

To run Mule from any Java application, you can call one of its configuration builders. To use Mule XML configuration:

DefaultMuleContextFactory muleContextFactory = new DefaultMuleContextFactory();
SpringXmlConfigurationBuilder configBuilder = new SpringXmlConfigurationBuilder("mule-config.xml");
muleContext = muleContextFactory.createMuleContext(configBuilder);

Make sure you store a reference to the MuleContext, as you will need it to stop Mule.

If you have multiple configuration files, you can provide a comma-separated list or an array of configuration files:

SpringXmlConfigurationBuilder configBuilder =
     new SpringXmlConfigurationBuilder(new String[] { "mule-config.xml", "another-config.xml" });

You then call the start method to start the server:

muleContext.start();