4.1.5. Using JMX Beans
With JMX beans you can expose some administrative functionality of your application without creating a user interface for it. The functionality becomes available via the built-in JMX console and via external JMX tools like jconsole
.
In our example with discounts, a user having access to JMX console is able to recalculate discounts for all customers and for a customer with a given id.
Studio cannot help you with scaffolding JMX beans at the moment, so all classes and configuration entries have to be created manually in the IDE.
See an example implementation in the demo application:
-
DiscountsMBean.java - JMX bean interface.
-
Discounts.java - JMX bean implementation.
-
DiscountCalculator.java - a managed bean of the middle tier which is invoked by the JMX bean. A JMX bean can contain the business logic itself, but we will use this delegate to share logic with services and entity listeners.
-
spring.xml - registers the JMX bean.