Reputation: 458
I want to send a MXBean as a message from one endpoint to another. Does the JMX message format already included in Apache Camel support this?
My project involves me getting an MXBean of a JVM on a local machine. I will be using the CompilationMXBean, MemoryMXBean etc.... [found in java.lang.management.*] to get the JVM information.
Also i am using an XML file to create routes. And then creating the components/endpoints in Java.( using the dispatch/acquire functions).
Or is there a way to create custom message parsing? Am fairly new to apache camel.
Thanks in advance.
Upvotes: 0
Views: 165
Reputation: 55750
You may also want to take a look at jolokia (http://www.jolokia.org/) - its a great project to make it easier to integrate with JMX in local and remote JVMs and use a simpler API that can be REST and JSON based.
It supports bulk operations, so you dont have chatty calls etc.
We are using Jolokia in our hawt.io project (http://hawt.io/) to gather data from a web based console from remote JVMs that run Camel, ActiveMQ, ServiceMix, and the likes.
Upvotes: 2
Reputation: 16056
The JMX component in Camel is really intended to pass around JMX notifications. The MXBeans are not passable as messages themselves, but if I understand what you're trying to do, there's a couple of ways you can pass data samplings as Camel messages:
Pass an encapsulated reference to an endpoint which interprets the reference into one or more JMX calls to the referenced MBeanServer/MXBean to acquire the specified values. A reference can be generically encoded as a JMXServiceURL, an ObjectName and a list of attribute names or operation name/parameter pairs.
Alternatively, you could create a new MXBean, installed on your target JVMs, that periodically samples all the required local MXBean data, aggregates it and emits it as a JMX notification. The emitted notifications can then be handled by the standard Camel JMX component.
Upvotes: 2