developer blog

JMX Notifications with Spring

The JMX notification API adds a good management aspect to an application. Bypassing the philosophical question of what is management and how does it differ from the rest of my application code here. Once we’ve decided to add management to our application there is a set of concerns that comes with that decision. Minimal impact on application performance/runtime being, minimal impact on “business” code. A natural direction to go with here is AOP since it introduces minimal changes to the code. I want to show how you can combine Spring AOP with JMX notifications to perform lightweight remote monitoring a business object in your application.
First we define our business object, a search service in this case, accepting a set of arguments defining the criteria for the search and a maximum result count limiter, these are the values that I wish to monitor and log elsewhere.