2015-08-11

Apache Camel 2.16 - Components with custom JMX is now addon on top of standard set of JMX

In the upcoming Apache Camel 2.16 I took a second attempt (I am currently writing about JMX for the Camel in Action 2nd edition book) of making it much easier to define custom JMX attributes and operations on your components, and have that added together with the standard set of JMX that Camel provides by default.

Beforehand it was not possible to add custom JMX operations and having the standard set included out of the box. To make this possible, you would need to re-expose the standard set of JMX in your custom component.

But I am happy to have found a solution that is being committed shortly to Apache Camel 2.16. 

So given this simple custom component (from the Camel in Action book), which exposes a single JMX attribute named verbose, on the custom component called ERP.

Custom component exposes a JMX attribute named Verbose
Then using this component at runtime would in Apache Camel 2.15.2 only show the Verbose attribute:


But the same code running on Apache Camel 2.16.0 now has all the default JMX attributes and operations as well:


This works also for any custom bean you may use in your routes. So for example if you call a POJO using using bean in the route DSL, then the custom POJO will be listed in JMX under processors. All you have to do in your POJO is to annotate it with the Camel @ManagedResources and then @ManagedAttribute for attributes and @ManagedOperation for operation.

All the existing Camel components we have (150+) could also benefit from this. So they could expose more custom information in JMX for their endpoints, consumer, producers etc. We have hold back a bit in the past to do this, due to this problem. But with a solution we can now move on. This task has been logged as CAMEL-9074.


No comments: