Over a million developers have joined DZone.

Defining Custom JMX Attributes in Apache Camel 2.16

DZone's Guide to

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
Free Resource

Share, secure, distribute, control, and monetize your APIs with the platform built with performance, time-to-value, and growth in mind. Free 90-day trial of 3Scale by Red Hat

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.

Explore the core elements of owning an API strategy and best practices for effective API programs. Download the API Owner's Manual, brought to you by 3Scale by Red Hat

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.


Dev Resources & Solutions Straight to Your Inbox

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 }}