Mule ESB社区版没有Mule Management Console(MMC),但是往往需要获知某个接口调用情况等基本信息。因此经过一番科学上网学习,终于找到了方法。
    
    MuleSoft提供了MBean,如果使用JConsole就可以查看到相关ESB Flow的信息。如果需要WEB形式的话,那Jolokia和Hawtio的组合无疑是当前首选。
   
    
     前期准备
    
    
    Mule Version :mule-standalone-3.9.0
    
    Jolokia Version :1.5.0(当前最新)
    
    下载地址:
    
     http://jolokia.org/download.html
    
    
    Hawtio Version : 1.5.9(当前最新)
    
    下载地址:
    
     http://hawt.io/getstarted/index.html
    
    (下载app那个版本,用java命令就可以启动,测试方便)
   
    Jolokia下载下来的是一个jar包,将其放到
    
     {MULE_HOME}\lib\opt\
    
    下,然后打开
    
     {MULE_HOME}\apps\default\
    
    下的
    
     mule-config.xml
    
    ,添加一些Jolokia所需的内容
    
     注意XML头部也有信息添加
    
<mule xmlns="http://www.mulesoft.org/schema/mule/core"  
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
    xmlns:management="http://www.mulesoft.org/schema/mule/management"  
    xmlns:spring="http://www.springframework.org/schema/beans"  
    xsi:schemaLocation="  
      http://www.mulesoft.org/schema/mule/core  
            http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd  
      http://www.springframework.org/schema/beans  
            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd  
      http://www.mulesoft.org/schema/mule/management  
            http://www.mulesoft.org/schema/mule/management/3.1/mule-management.xsd">  
    <!-- MULE-5011 empty config to avoid the hot deployment classloader choking on a missing config file -->
    <custom-agent name="jolokia-agent" class="org.jolokia.mule.JolokiaMuleAgent">
        <spring:property name="port" value="8899"/>
    </custom-agent>
    <management:jmx-server>  
        <management:connector-server url="service:jmx:rmi:///jndi/rmi://localhost:7099/mule" rebind="true" />  
    </management:jmx-server>
</mule>
    自此,Jolokia与Mule的整合完毕。
    
    Hawtio下载下来的也是一个jar包,这个jar包可以执行,在
    
     {HAWTIO_JAR_FOLDER}
    
    下代开CMD窗口,执行命令
    
     java -jar hawtio-x-x-x.jar
    
    ,然后耐心等候,启动成功将会打开你的默认浏览器,打开浏览器后路径是
    
    
     http://localhost:8080/hawtio/jvm/connect
    
    ,这时候可以看见界面如下:
   
     
   
    点击蓝色按钮连接,就可以开始愉快的玩耍了。
    
     
   
    奉上Jolokia参考手册:
    
     https://jolokia.org/reference/html/protocol.html
    
    
    
     写在最后
    
    :Hawtio1.5.9使用的jQuery版本是
    
     1.12.x
    
    ,Hawtio的Dashboard添加组件后,右下角的拖动会提示错误,原因是
    
     browser.msie
    
    已经在jQuery1.9版本后移除了,反正火狐和谷歌拖动大小是报错的,IE系的浏览器就不会有这样的问题。
   
    后续补充2018-08-24
   
这种方式能起到的监控作用不大,除了获取接口调用情况及启动关闭接口外,更多的监控功能便没有了,想达到MMC的效果,可能还得另辟蹊径二次开发。
 
