Hi Peter

I'd say an MBean is a reasonable way to expose that sort of thing to
Brooklyn (or any management/orchestration tool) for a Java app.  I guess
there would be other ways of doing it without JMX but they might be more
ad-hoc, while this is just the sort of thing JMX is for.

Since you're already thinking about using (extending) VanillaJavaApp in
Brooklyn to manage your app,  you could look into adding sensors for
whatever MBeans you want to expose from your app using JmxFeed. There is
some documentation for this at [1]. You could also use the code for
TomcatServerImpl [2] as a reference, as it uses JmxFeeds.

Just my 2ยข. It's not something I've done myself I'm afraid, so I don't have
any better example I can point you to.

Geoff

[1] https://brooklyn.apache.org/v/latest/blueprints/java/feeds.html#jmx-feed
[2]
https://github.com/apache/brooklyn-library/blob/master/software/webapp/src/main/java/org/apache/brooklyn/entity/webapp/tomcat/TomcatServerImpl.java


On Mon, 11 Mar 2019 at 00:21 Peter Abramowitsch <[email protected]>
wrote:

> I'm interested in adding some custom sensing in my app.  Using the
> VanillaJavaApp Entity,  let's say I would like my application whose main
> class is set in the blueprint to send back a dynamic "records processed
> count" and have it appear in amongst the other sensors on Brooklyn's web
> UI.
>
> My Java app is not a webserver,  just a long-running process.  Is the
> correct approach to create an MBean as part of my app and connect it back
> to Brooklyn's server?   I'm not sure how to put all the pieces together...
> or if there's a better way.  Can it be done without extending Brooklyn
> itself?
>
> Peter
>

Reply via email to