Lord_Rafa
Lord_Rafa

Reputation: 23

Is there any way to get JMX stats whithing my APP programatically

I was reading about how to get some stats in java using JMX and I can see that mostly of the solutions that are proposed on the internet uses a client to get them remotelly.

I would like to know if it would be posible to get them programatically inside my code without open a conection (not even to localhost).

I am interested in reading the current the lag for a kafka group, that uses reactor kafka to create the consumers.

thx

Upvotes: 1

Views: 190

Answers (1)

Gary Russell
Gary Russell

Reputation: 174494

Get a reference to the MBeanServer then you can run a query with the ObjectName.

Upvotes: 1

Related Questions