No word from MuleSoft as to when/whether the enhancement request will go through. However, MuleSoft's support team did provide a workaround:
- Create interface that defines methods you want to expose in JMX
- Implement interface in UntilSuccessfulSubclass
Include the following method in
initialise()
:private void registerMBean() { final JmxSupportFactory jmxSupportFactory = AutoDiscoveryJmxSupportFactory.getInstance(); final JmxSupport jmxSupport = jmxSupportFactory.getJmxSupport(); final MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); final String rawName = getName() + "(" + getType() + ")"; final String name = jmxSupport.escape(rawName); final String jmxName = String.format("%s:%s%s", jmxSupport.getDomainName(muleContext, !muleContext.getConfiguration().isContainerMode()), "type=ODM,name=", name); try { final ObjectName on = jmxSupport.getObjectName(jmxName); final ClassloaderSwitchingMBeanWrapper mBean = new ClassloaderSwitchingMBeanWrapper(this, UntilSuccessfulMBean.class, muleContext.getExecutionClassLoader()); logger.debug("Registering custom router with name: " + on); mBeanServer.registerMBean(mBean, on); } catch (final Exception e) { logger.error(e.getMessage()); } }
This approach does not require any change to the original Mule config file (partially referenced in my original post).
One downside to this approach is that my MBean has to appear in the Mule. directory in JMX instead of grouped with all of my other MBeans outside of that context, but it gets the job done. I don't have the points to spend on digging into Mule's JMX packages but it may be possible.