Contact Free trial Login

Using Mule Agents

This document refers to the Agent that communicates Mule Runtimes to the Mule Management Console, not to the one that communicates Mule Runtimes to the Runtime Manager

An agent is a service that is associated with or used by Mule but is not a Mule-managed component. Agents have the same lifecycle as the Mule instance they are registered with, so you can initialize and destroy resources when the Mule instance starts or is disposed.

Mule provides several agents for JMX support, including notifications and remote management. You can also create custom agents to plug any functionality into Mule, such as running functionality as a background process or embedding a server in Mule.

Configuring an Agent

Agents are defined in the Management module. To use an agent, specify the management namespace and schema, and then specify the properties for the agents you want to use. For example:

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns=""
  <management:jmx-default-config port="1098" registerMx4jAdapter="true" />

  <management:log4j-notifications logName="myMuleLog" logConfigFile="mule-log.txt"/>

  <management:chainsaw-notifications chainsawPort="8080" chainsawHost="" />

  <management:publish-notifications endpointAddress="vm://myService" />

For a list of agents provided with Mule and how to configure them, see JMX Management. You can also create a custom agent as described below.

Creating Custom Agents

To create your own agent, your agent class must implement org.mule.api.agent.Agent.

You then configure your agent using the <custom-agent> element, which takes two attributes: name specifies a unique name for this agent, and class specifies the class where it’s defined. If your agent requires that you pass in properties, you can specify them as name/value pairs. Note that this element is now in the core Mule namespace.

For example:

<custom-agent name="test-custom-agent" class="org.mule.tck.testmodels.mule.TestAgent">
  <spring:property name="frobbit" value="woggle"/>

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub