Am 21.10.2011 13:28, schrieb Claus Ibsen:
Hi Christian
On Tue, Oct 18, 2011 at 8:42 AM, Claus Ibsen<claus.ib...@gmail.com> wrote:
Hi
There is a JIRA ticket from the community about adding interfaces for
the various MBean we have in camel-core
https://issues.apache.org/jira/browse/CAMEL-4468
I think it would be valuable if you took at look at CAMEL-4468. You
have an keen interrest in API which can help here.
Its although API for JMX Clients (eg for Camel end users from a client
to access the Camel MBeans using an interface.). CAMEL-4468 makes this
easier for clients as the JDK JMX API has a way of proxy using a
interface, which makes it much easier for clients to access MBeans.
Basically something like this code line
Object jmx_proxy =
MBeanServerInvocationHandler.newProxyInstance(getMBeanServerConnection(),
objectName, interfaceClass, notificationBroadcaster);
That makes it easier for Camel end users to acces the Camel MBeans.
However the other point is how Camel itself registers MBeans in the
MBeanServer. This is still using JMX annotations (Camel or Spring JMX
annotations). But we can add support for MXBean interfaces as well (eg
possible the interfaces from CAMEL-4468).
However the benefit of the JMX annotations is that they allow you to
add meta data such as description and possible other stuff we can add
as well. Also with JMX annotations its sort of a "mix in" approach
where Camel can use a ManagedEndpoint as base class and then add those
additional JMX annotations for a component. See for example camel-jms
in the JmsEndpoint class, how we can easily add special JMX attributes
and operators. Using interfaces this becomes as far as I can see, more
difficult.
Can you explain how this Mixin aproach is better than an interface?
To do the same for JmsEndpoint that the annotations do you would just
have to let it implement JmsEndpointMXBean and also have the getters and
setters for the attributes there.
I assume those interface would transpose to the MXBeans beans you refer to?
Exactly if you create the MXBeans using interfaces named ClasNameMXBean
then the JDK knows how to instantiate the MXBean and the user can use this
interface for proxies.
That would be a good idea to have both the interfaces and the @Managed
annotations,
the interfaces makes it easier for community end users who want as a
client to access Camel JMX details.
And this is easier to do with a proxy from a interface.
At the moment I have no idea how we could have both in the same bean. So
we have to decide for each bean.
Christian
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
Talend Application Integration Division http://www.talend.com