Contact Free trial Login

Starting and Stopping Mule

This section deals with starting and stoping Mule and deploying applications. To take full advantage of managing and monitoring features, you can deploy to the same Mule via the Runtime Manager.

Mule uses the Java Service Wrapper to control the Java Virtual Machine (JVM) from your native OS. The wrapper provides many options and features, including the ability to run Mule as a Unix daemon or install or remove Mule as a Windows Service. The wrapper can handle system signals and start parameters, and overall provides much better interaction between the JVM and the underlying OS.

Startup and Shutdown Script

The wrapper is called by a script in $MULE_HOME/bin.

The table below lists all the parameters that the script accepts.

Parameter Description

start

Starts Mule in the terminal background.

stop

Stops Mule. Inbound endpoints process in-flight messages before Mule shuts down. However, after the timeout period, inflight messages that haven’t completed are abandoned and Mule shuts down.

restart

Restarts Mule.

status

(Linux/Unix only.) Displays the status of the Mule server (running or not running) and the process PID if running.

dump

(Linux/Unix only.) Dumps the Mule wrapper’s core to $MULE_HOME/log/mule_ee.log.

console

Start Mule in the terminal foreground (console mode). Same as running mule with no parameters.

install

Install Mule to run it as a Windows Service or Linux/Unix Daemon.

remove

Remove Mule from your Windows Services or Linux/Unix Daemons.

Running Mule

Start Mule from a command line by changing the directory to where you unzipped the Mule software distribution and then changing to the bin directory. Run the following commands:

  • On Windows environments:

    $ $MULE_HOME\bin\mule.bat
  • On Linux/Unix environments:

    $ $MULE_HOME/bin/mule

These commands run Mule in foreground mode, and the startup script displays information on the terminal’s standard output. You can’t issue further commands on the terminal as long as Mule is running.

To stop Mule, press CTRL-C in the terminal in which the script is running.

Starting Mule as a Windows Service

To run Mule as a Windows service, you need to install it first by running:

$ $MULE_HOME\bin\mule.bat install

Once installed, you can run Mule as a service:

$ $MULE_HOME\bin\mule.bat start

When Windows restarts, the Mule service stops the same way as using the mule stop command. The only situation where this could be different is if Windows kills the process due to a timeout.

Adding Properties to wrapper.conf File After Installation

After the installation of Mule as a Windows service, you can override the properties defined in the wrapper.conf file by declaring new properties in the wrapper.additional.conf file.

The behavior changes depending on the Mule edition you are using:

  • Mule Community Edition

    1. After adding a new property, reinstall or restart the Windows Service.

    2. Add the property and ensure that its index is greater than the greatest index in the wrapper-additional.conf file. Otherwise, your property can be overridden.

      For example, if the wrapper-additional.conf has the property:

      wrapper.java.additional.n=-Dproperty=value

      When n is the greatest index, you should add your property in the wrapper.conf file incrementing the index:

      wrapper.java.additional.n+1=-DyourProperty=valueOfYourProperty

  • Mule Enterprise Edition

    1. By default, you can add 20 extra properties after installing Mule as a Windows service.

    2. Configure the number of extra properties you need, using the following command line argument when you install the service:

      -additionalJavaProperties=numberOfExtraProperties

Starting Mule as a Linux/Unix Daemon

To run Mule as a Linux/Unix Daemon, you need to install it first by running:

$ $MULE_HOME/bin/mule install

Once installed, you can run Mule as a daemon:

$ $MULE_HOME/bin/mule start

You can also start Mule without executing the installation step. This starts Mule in the background for the current user session.

This example starts Mule from a Unix console:

$ $MULE_HOME/bin/mule start
MULE_HOME is set to ~/Downloads/mule-enterprise-standalone-4.1.5
MULE_BASE is set to ~/Downloads/mule-enterprise-standalone-4.1.5
Starting Mule Enterprise Edition...
Waiting for Mule Enterprise Edition.................
running: PID:87318

Starting Mule from a Script

To start Mule from a script or from your IDE without using the Java Service Wrapper, you can use the org.mule.MuleServer class. This class accepts a couple of parameters.

org.mule.MuleServer -config mule-config.xml

or

org.mule.MuleServer -builder <fully qualified classname> -config appContext.xml
  • -config specifies one or more configuration files to use. If this argument is omitted, it will look for and use mule-config.xml if it exists.

  • -builder is a fully qualified classname of the configuration builder to use. If this is not set, the default org.mule.config.builders.AutoConfigurationBuilder is used, which will try to auto-detect configuration files based on available builders. In the most common scenario, this will resolve to org.mule.config.spring.SpringXmlConfigurationBuilder.

The easiest way to set the classpath is to include all JARs in the ./lib/mule and ./lib/opt directories of the distribution. You can look at the dependency report for the server and each of the modules to see exactly which JARs are required for a particular module.

Deploying Mule Applications

  1. Start Mule.

  2. After Mule starts, you can deploy your Mule applications by moving your packaged JAR files to the apps directory in $MULE_HOME.

Stopping Mule

Use the stop command to stop Mule.

This example stops Mule from a Unix console:

$ $MULE_HOME/bin/mule stop
MULE_HOME is set to /Applications/mule-enterprise-standalone-4.1.5
MULE_BASE is set to /Applications/mule-enterprise-standalone-4.1.5
Stopping Mule Enterprise Edition...
Stopped Mule Enterprise Edition.

Removing the Mule Service or Daemon

Use the remove command to remove the service or daemon from your system.

This example removes the Mule daemon from a Unix console:

$ $MULE_HOME/bin/mule remove
MULE_HOME is set to /Applications/mule-enterprise-standalone-4.1.5
MULE_BASE is set to /Applications/mule-enterprise-standalone-4.1.5
Detected Mac OSX:
Mule Enterprise Edition is not running.
Removing Mule Enterprise Edition daemon...

Enable Anypoint Monitoring

Optionally, you can install Anypoint Monitoring for cloud-managed supported versions of on-premises runtimes so you can monitor applications running on that server.

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.