Over a million developers have joined DZone.

Defining Custom JMX Attributes in Apache Camel 2.16

It used to not be possible to add custom JMX operations, but see how Clause Ibsen is working to commit custom JMX components.

· Integration Zone

Is iPaaS solving the right problems? Not knowing the fundamental difference between iPaaS and dPaaS could cost you down the road. Brought to you in partnership with Liaison Technologies.

Apache Camel 2.16 - Components with custom JMX is now an addon on top of the 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 it to the standard set of JMX that Camel provides by default.

Beforehand, it was not possible to add custom JMX operations to the standard set. 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. 

This simple custom component (from the Camel in Action book) exposes a single JMX attribute named verbose on the custom component called ERP.

The custom component exposes a JMX attribute named Verbose. Using this component at runtime in Apache Camel 2.15.2 only shows 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. For example, if you call a POJO 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 annotate it with the Camel @ManagedResources and then @ManagedAttribute for attributes and @ManagedOperation for operations.

All the existing Camel components we have (150+) could also benefit from this. They would be able to expose more custom information in JMX for their endpoints, consumer, producers, etc. We have held back a bit in the past to do this due to this problem. This task has been logged as CAMEL-9074.

Discover the unprecedented possibilities and challenges, created by today’s fast paced data climate and why your current integration solution is not enough, brought to you in partnership with Liaison Technologies.

apache camel ,jmx ,fuse ,camel

Published at DZone with permission of Claus Ibsen, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}