Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Export beans through JMX

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 griffon-app
Octocat-spinner-32 .gitignore
Octocat-spinner-32 JmxGriffonAddon.groovy
Octocat-spinner-32 JmxGriffonPlugin.groovy
Octocat-spinner-32 LICENSE.txt
Octocat-spinner-32 README.md
Octocat-spinner-32 application.properties
README.md

Enables JMX on a Griffon applicatin

Plugin page: http://artifacts.griffon-framework.org/plugin/jmx

This plugin adds JMX MBeanServer support through spring and configures a number MBeans. A direct port of the JMX plugin for Grails. Original plugin made by Ken Sipe.

Plugin features:

  • Configures an MBeanServer
  • Exposes any Service configured for jmx
  • Allows other Spring beans to be configured for jmx
  • Addons may expose additional beans

Usage

There is nothing to do after the install if you have no services to expose. Just run the application and use jconsole to administrate.

 Exposing Services

By default, the plugin only supports exposing Services. This is accomplished by add 'jmx' to the static expose property as outlined below:

    class StateService {
        static expose = ['jmx']
        ...
    }

This will expose the service leverage a convention for the service name. Alternatively you can be very explicit on the object through the following example:

    class CountryService {
        static expose = ['jmx:service=Country,type=special']
        ...
    }

 Exposing Spring beans

The plugin also supports exposing other Spring Beans - e.g. registered via src/spring/resources.groovy. This is accomplished by adding jmx to the static expose property as outlined above and using the following code in Config.groovy

    griffon {
        jmx {
            exportBeans = ['myBean']
        }
    }

 Exposing beans on addons

Any addon may expose additional beans to the MBeanServer by adding a exposeWithJmx closure property to its descriptor. The following example shows how the [Datasource Plugin] exposes its database

    // exporter is of type MBeanExporter
    // domain is of type String
    // ctx is of type ApplicationContext
    def exportwithJmx = { exporter, domain, ctx ->
        String beanKey = "${domain}:service=datasource,type=configuration"
        exporter.beans[beanKey] = DataSourceHolder.instance.getDataSource('default')
    }
Something went wrong with that request. Please try again.