You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by MbeanUser <do...@gmail.com> on 2014/02/07 12:00:46 UTC

Building an external control layer, is JMX the right choice for interfacing and monitoring ServiceMix

I am going to construct a control layer on top of ServiceMix, that will
interface with a web gui through a REST api. The idea being that I can stop
/ start / add routes in Camel through my web page when it is all done.

My current idea for the overall program flow.

ServiceMix <-> Control layer through JMX.

>From what I have been able to gather, JMX is the way to go when interfacing
with the ServiceMix instance. I have made a small POC, where I connect to
the MBeanServer and create Proxy MBeans for the functionality I want,
Routes, Components etc.

Is JMX the right way to go here? Is there any other way to programmatically
interface with ServiceMix. I just want to be sure before I go into
development.

Thank you in advance.



--
View this message in context: http://servicemix.396122.n5.nabble.com/Building-an-external-control-layer-is-JMX-the-right-choice-for-interfacing-and-monitoring-ServiceMix-tp5718933.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Building an external control layer, is JMX the right choice for interfacing and monitoring ServiceMix

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Feb 11, 2014 at 3:41 PM, MbeanUser <do...@gmail.com> wrote:
> Thank you all very much for the responses. They have certainly given some
> inspiration and interesting reading.
>
> I have looked into Jolokia. It looks very promising in some ways, but might
> not be correct choice for me in others. My main concern is that I would like
> to hide JMX usage from the REST API user, as I feel JMX is very java
> specific and might introduce unnecessary overhead to users. In my dream
> scenario, I user could sit down and write a gui against my API without
> knowing anything about JMX at all.
>
> I am still looking into using jolokia in the control layer vs the standard
> javax.management.*;
> javax.management.JMX vs J4pClient is very interesting, but I need to
> research a bit more.
>
> Claus Ibsen. Thank you so much for the github link for hawt.io.
>
> This might be a bit more of a camel question than an actual Servicemix
> question. I do not know, if it warrants its own topic or not.
>
> I need to find all available components on my ServiceMix instance. That
> means all premade components file, timer, direct etc etc, but also all
> custom components added at runtime.
>

There is JMX API on CamelContextMBean a method call findComponentNames
that can be used to find all known camel components on the classpath
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/api/management/mbean/ManagedCamelContextMBean.html

We had some bugs in it, that was recently fixed, so you may need to
use latest release to have it properly work.

That api should return all the camel components that are in use, and
also the components that have been installed by are not currently
active in use. For example as you say you can only see the file
component because it in use in a Camel route. But this api will return
it regardless as the file component is from camel-core which is always
installed when you use Camel.

Another trick could be to read the camel features.xml (karaf may have
JMX API to expose those) as each camel feature is usually a camel
component you can use/install. eg camel-ftp is the ftp components, and
so forth.


> Looking a my locally running ServiceMix instance MBeanServer I found MBean
> type:
> org.apache.camel:type=components
> The only visible components however, are components that have been used. In
> my case I can only see a file component as I have deployed a route using
> that component. Is this even possible?
>
> Looking through the hawt github, I could only find things related to
> endpoints:
> https://github.com/hawtio/hawtio/blob/master/hawtio-web/src/main/webapp/app/camel/js/browseEndpoint.ts
>
> How do you handle creating a route. Looking here:
> https://github.com/hawtio/hawtio/blob/master/hawtio-web/src/main/webapp/app/camel/js/routes.ts
> You use Camel.addRouteXmlChildren($scope, routeXmlNode, nodes, links, null,
> 0, 0), which I guess is built on addOrUpdateRoutesFromXml("route in xml
> form") on a context mbean.
> How do you inform the user about what components are available for his
> route?
>

You need to handle this manually. For example using that api I mentioned before.


> Sorry for the long and perhaps poorly formulated question.
>
> Thank you in advance
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/Building-an-external-control-layer-is-JMX-the-right-choice-for-interfacing-and-monitoring-ServiceMix-tp5718933p5718991.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io

Re: Building an external control layer, is JMX the right choice for interfacing and monitoring ServiceMix

Posted by MbeanUser <do...@gmail.com>.
Thank you all very much for the responses. They have certainly given some
inspiration and interesting reading.

I have looked into Jolokia. It looks very promising in some ways, but might
not be correct choice for me in others. My main concern is that I would like
to hide JMX usage from the REST API user, as I feel JMX is very java
specific and might introduce unnecessary overhead to users. In my dream
scenario, I user could sit down and write a gui against my API without
knowing anything about JMX at all.

I am still looking into using jolokia in the control layer vs the standard
javax.management.*;
javax.management.JMX vs J4pClient is very interesting, but I need to
research a bit more.

Claus Ibsen. Thank you so much for the github link for hawt.io. 

This might be a bit more of a camel question than an actual Servicemix
question. I do not know, if it warrants its own topic or not.

I need to find all available components on my ServiceMix instance. That
means all premade components file, timer, direct etc etc, but also all
custom components added at runtime.

Looking a my locally running ServiceMix instance MBeanServer I found MBean
type:
org.apache.camel:type=components
The only visible components however, are components that have been used. In
my case I can only see a file component as I have deployed a route using
that component. Is this even possible?

Looking through the hawt github, I could only find things related to
endpoints:
https://github.com/hawtio/hawtio/blob/master/hawtio-web/src/main/webapp/app/camel/js/browseEndpoint.ts

How do you handle creating a route. Looking here:
https://github.com/hawtio/hawtio/blob/master/hawtio-web/src/main/webapp/app/camel/js/routes.ts
You use Camel.addRouteXmlChildren($scope, routeXmlNode, nodes, links, null,
0, 0), which I guess is built on addOrUpdateRoutesFromXml("route in xml
form") on a context mbean.
How do you inform the user about what components are available for his
route?

Sorry for the long and perhaps poorly formulated question.

Thank you in advance 



--
View this message in context: http://servicemix.396122.n5.nabble.com/Building-an-external-control-layer-is-JMX-the-right-choice-for-interfacing-and-monitoring-ServiceMix-tp5718933p5718991.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Building an external control layer, is JMX the right choice for interfacing and monitoring ServiceMix

Posted by Claus Ibsen <cl...@gmail.com>.
On Sat, Feb 8, 2014 at 2:49 AM, Freeman Fang <fr...@gmail.com> wrote:
> Yep, and also please check powerful hawt.io[1] which use Jolokia underlying.
>
> [1]http://hawt.io/
> -------------
> Freeman(Yue) Fang
>
> Red Hat, Inc.
> FuseSource is now part of Red Hat
>

Yeah I would recommend looking at jolokia which can easily be
installed in ServiceMix. Then from the client point of view, its just
REST calls to the server to manage it.

We use this in hawtio to control Camel routes, visualize routes, et
all. And a lot more.

The Camel plugin source code is here
https://github.com/hawtio/hawtio/tree/master/hawtio-web/src/main/webapp/app/camel

For example some of the operations to start|stop is here
https://github.com/hawtio/hawtio/blob/master/hawtio-web/src/main/webapp/app/camel/js/attributesToolBar.ts

Though the Camel plugin is a bit more advanced as its using a JMX
plugin for some of its work as well. So its not the easiest plugin to
learn.

Anyway just wanted to point out the awesomeness of jolokia. And the
fact you can build modern HTML5 single page apps.
http://jolokia.org/

And btw hawtio is pluggable and skinnable, so users can use it to
build their own plugins and apps.


>
>
> On 2014-2-7, at 下午9:36, Filippo Balicchia wrote:
>
>> Hi,
>>
>> have you already examined if Jolokia can be used in your solution ?
>>
>> --Filippo
>>
>>
>> 2014-02-07 12:00 GMT+01:00 MbeanUser <do...@gmail.com>:
>>
>>> I am going to construct a control layer on top of ServiceMix, that will
>>> interface with a web gui through a REST api. The idea being that I can stop
>>> / start / add routes in Camel through my web page when it is all done.
>>>
>>> My current idea for the overall program flow.
>>>
>>> ServiceMix <-> Control layer through JMX.
>>>
>>> From what I have been able to gather, JMX is the way to go when interfacing
>>> with the ServiceMix instance. I have made a small POC, where I connect to
>>> the MBeanServer and create Proxy MBeans for the functionality I want,
>>> Routes, Components etc.
>>>
>>> Is JMX the right way to go here? Is there any other way to programmatically
>>> interface with ServiceMix. I just want to be sure before I go into
>>> development.
>>>
>>> Thank you in advance.
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://servicemix.396122.n5.nabble.com/Building-an-external-control-layer-is-JMX-the-right-choice-for-interfacing-and-monitoring-ServiceMix-tp5718933.html
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io

Re: Building an external control layer, is JMX the right choice for interfacing and monitoring ServiceMix

Posted by Freeman Fang <fr...@gmail.com>.
Yep, and also please check powerful hawt.io[1] which use Jolokia underlying.

[1]http://hawt.io/
-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat



On 2014-2-7, at 下午9:36, Filippo Balicchia wrote:

> Hi,
> 
> have you already examined if Jolokia can be used in your solution ?
> 
> --Filippo
> 
> 
> 2014-02-07 12:00 GMT+01:00 MbeanUser <do...@gmail.com>:
> 
>> I am going to construct a control layer on top of ServiceMix, that will
>> interface with a web gui through a REST api. The idea being that I can stop
>> / start / add routes in Camel through my web page when it is all done.
>> 
>> My current idea for the overall program flow.
>> 
>> ServiceMix <-> Control layer through JMX.
>> 
>> From what I have been able to gather, JMX is the way to go when interfacing
>> with the ServiceMix instance. I have made a small POC, where I connect to
>> the MBeanServer and create Proxy MBeans for the functionality I want,
>> Routes, Components etc.
>> 
>> Is JMX the right way to go here? Is there any other way to programmatically
>> interface with ServiceMix. I just want to be sure before I go into
>> development.
>> 
>> Thank you in advance.
>> 
>> 
>> 
>> --
>> View this message in context:
>> http://servicemix.396122.n5.nabble.com/Building-an-external-control-layer-is-JMX-the-right-choice-for-interfacing-and-monitoring-ServiceMix-tp5718933.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> 


Re: Building an external control layer, is JMX the right choice for interfacing and monitoring ServiceMix

Posted by Filippo Balicchia <fb...@gmail.com>.
Hi,

have you already examined if Jolokia can be used in your solution ?

--Filippo


2014-02-07 12:00 GMT+01:00 MbeanUser <do...@gmail.com>:

> I am going to construct a control layer on top of ServiceMix, that will
> interface with a web gui through a REST api. The idea being that I can stop
> / start / add routes in Camel through my web page when it is all done.
>
> My current idea for the overall program flow.
>
> ServiceMix <-> Control layer through JMX.
>
> From what I have been able to gather, JMX is the way to go when interfacing
> with the ServiceMix instance. I have made a small POC, where I connect to
> the MBeanServer and create Proxy MBeans for the functionality I want,
> Routes, Components etc.
>
> Is JMX the right way to go here? Is there any other way to programmatically
> interface with ServiceMix. I just want to be sure before I go into
> development.
>
> Thank you in advance.
>
>
>
> --
> View this message in context:
> http://servicemix.396122.n5.nabble.com/Building-an-external-control-layer-is-JMX-the-right-choice-for-interfacing-and-monitoring-ServiceMix-tp5718933.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>