<?xml version="1.0" encoding="UTF-8"?> <mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:management="http://www.mulesoft.org/schema/mule/management" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/management http://www.mulesoft.org/schema/mule/management/current/mule-management.xsd"> <management:jmx-default-config port="1098" registerMx4jAdapter="true" /> <management:log4j-notifications logName="myMuleLog" logConfigFile="mule-log.txt"/> <management:chainsaw-notifications chainsawPort="8080" chainsawHost="127.0.0.1" /> <management:publish-notifications endpointAddress="vm://myService" />
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:
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
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.
<custom-agent name="test-custom-agent" class="org.mule.tck.testmodels.mule.TestAgent"> <spring:property name="frobbit" value="woggle"/> <custom-agent>