For the past 3 weeks or more I have been working hard on giving an
overhaul of the management of Apache Camel. This works is starting to shape up really well, so I thought I wanted to share this in a blog.
We knew that in Apache Camel 1.x the management using JMX was a bit limited and therefore promised that we would address this in Camel 2.1.
A breakdown of the noteworthy improvements and new features are:
- Pluggable management API to allow 3rd part to fully integrate their own management of Camel
- Introduced event notifications targeted at operations staff
- Overhaul of exiting mbeans and added many new mbeans types
- Full lifecycle support to start/stop camel, routes, consumers, producers, services etc.
- Many more attributes visible such as: State, Route Ids, Endpoint Uris so you can pin point the mbean where it belongs
- More statistics gathered
- Tracer can be fully managed for example to enable/disable tracing on a particular route to help understand how messages are routed at runtime
- Route statistics is now accurate :)
- Error handlers is now fully managed as well, for example to change redelivery policies at runtime
- JMS is fully manageable so you at runtime for example can change number of concurrent consumers
- Certain EIP are manageable as well such as Throttler, Delayer, WireTap, etc. More to be added in the future.
- Easier to let custom Camel components be managed as well by implementing ManagementAware SPI interface
- Component specific management such as JMS, Timer, Scheduled Poller (File, FTP, Mail, and others). And many more to come.
- Pluggable naming strategy in case you want to register the mbean using a different naming convention
- Granularity of performance statistics can be preset on startup to either: All, RoutesOnly or Off. At runtime you can turn it on/off at each mbean that supports statistics.
- And more I may have forgotten
The following lists the different mbean types currently being registered for management at runtime
- CamelContext
- Components
- Endpoints
- Routes
- Consumers
- Producers
- Processors
- ErrorHandlers
- Tracer
- ... and maybe more to come
On top of that we have added a
new management example that demonstrates this improved management of Camel. You can then play with the example to change configuration at runtime to e.g. try to improve the overall throughput of the messages being routed in the example.
What we also will do in the future is to add continue to add component specific management such as we already have done for JMS, Timer and the scheduled pollers such as file and ftp. For example we got camel-quartz on the radar so you can change it as well at runtime.
All you need to do is to implement the ManagementAware interface and then Camel knows its has custom management instead of using the default it would have used otherwise. Then you would as often decorate the component endpoint, consumer, producer etc. with the spring @ManagedXXX annotations to expose the attributes and operations. That is all there is to it. And if you want to
contribute to Camel then grab a
component of choice and help us with a patch.
This is also an announcement to give you the chance and time to try out the new management in the upcoming Apache Camel 2.1. And please any feedback is much welcome. Its better that we get it while we are working on it than after the release.