Thursday, July 14, 2011

Mule - Default Jmx Agent

One can configure several JMX agents simultaneously using the <jmx-default-config> element. When set, this element registers the following agents:
  • JMX agent
  • RMI registry agent (if necessary) on rmi://localhost:1099
  • Remote JMX access on service:jmx:rmi:///jndi/rmi://localhost:1099/server
  • (Optional) Log4J JMX agent, which exposes the configuration of the Log4J instance used by Mule for JMX management
  • JMX notification agent used to receive server notifications using JMX notifications
  • (Optional) MX4J adapter, which provides web-based JMX management, statistics, and configuration viewing of a Mule instance
When this change is included, mule-config.xml would look like the following.

mule-config.xml


<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.2"
    xmlns:file="http://www.mulesource.org/schema/mule/file/2.2"
    xmlns:vm="http://www.mulesource.org/schema/mule/vm/2.2" xmlns:smtp="http://www.mulesource.org/schema/mule/smtp/2.2"
    xmlns:http="http://www.mulesource.org/schema/mule/http/2.2"
    xmlns:management="http://www.mulesource.org/schema/mule/management/2.2"
    xmlns:spring="http://www.springframework.org/schema/beans"
    xsi:schemaLocation="
       http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
       http://www.mulesource.org/schema/mule/stdio/2.2 http://www.mulesource.org/schema/mule/stdio/2.2/mule-stdio.xsd
       http://www.mulesource.org/schema/mule/file/2.2 http://www.mulesource.org/schema/mule/file/2.2/mule-file.xsd
       http://www.mulesource.org/schema/mule/vm/2.2 http://www.mulesource.org/schema/mule/vm/2.2/mule-vm.xsd
       http://www.mulesource.org/schema/mule/smtp/2.2 http://www.mulesource.org/schema/mule/smtp/2.2/mule-smtp.xsd
       http://www.mulesource.org/schema/mule/http/2.2 http://www.mulesource.org/schema/mule/http/2.2/mule-http.xsd
       http://www.mulesource.org/schema/mule/management/2.2 http://www.mulesource.org/schema/mule/management/2.2/mule-management.xsd
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
    <management:jmx-default-config />
</mule>

With this configuration, when the server gets started, we should see the following message in the console.


**********************************************************************
* Mule ESB and Integration Platform                                  *
* Version: 2.2.1 Build: 14422                                        *
* MuleSource, Inc.                                                   *
* For more information go to http://mule.mulesource.org              *
*                                                                    *
* Server started: 14/7/11 11:29 PM                                   *
* Server ID: ff2b4fd4-ae9a-11e0-8ec4-b1cece6266a8                    *
* JDK: 1.6.0_21 (mixed mode, sharing)                                *
* OS encoding: Cp1252, Mule encoding: UTF-8                          *
* OS: Windows Vista - Service Pack 2 (6.0, x86)                      *
* Host: vijay-Laptop (192.168.1.65)                                  *
*                                                                    *
* Agents Running:                                                    *
*   Jmx Notification Agent (Listener MBean registered)               *
*   Rmi Registry: rmi://localhost:1099                               *
*   jmx-log4j                                                        *
*   jmx-agent: service:jmx:rmi:///jndi/rmi://localhost:1099/server   *
*   Default Jmx Support Agent                                        *
**********************************************************************

Now the Mule Mbeans can be accessed using JConsole and individual services can be started or stopped easily. Jconsole comes with JDK 1.6 by default.

JConsole Login

Accessing Mule MBeans through JConsole

No comments:

Post a Comment