0

I would like to enable the registration of the Mongo JMX MBeans as described in the Spring Data MongoDB Manual, not using the JMX configuration, but in Java. So I look for the corresponding Java code for the

<mongo:jmx />

element. Does this exist?

1 Answer 1

1

When trying to find the equivalent for beans created by any Spring XML parser, the first step is to look at the namespace handler, in this case MongoNamespaceHandler. Examining that class shows that the jmx namespace is parsed by the MongoJmxParser. Next step is to look at that and you'll see that it defines a bunch of beans; see here.

protected void registerJmxComponents(String mongoRefName, Element element, ParserContext parserContext) {
    Object eleSource = parserContext.extractSource(element);

    CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), eleSource);

    createBeanDefEntry(AssertMetrics.class, compositeDef, mongoRefName, eleSource, parserContext);
    createBeanDefEntry(BackgroundFlushingMetrics.class, compositeDef, mongoRefName, eleSource, parserContext);
    createBeanDefEntry(BtreeIndexCounters.class, compositeDef, mongoRefName, eleSource, parserContext);
    createBeanDefEntry(ConnectionMetrics.class, compositeDef, mongoRefName, eleSource, parserContext);
    createBeanDefEntry(GlobalLockMetrics.class, compositeDef, mongoRefName, eleSource, parserContext);
    createBeanDefEntry(MemoryMetrics.class, compositeDef, mongoRefName, eleSource, parserContext);
    createBeanDefEntry(OperationCounters.class, compositeDef, mongoRefName, eleSource, parserContext);
    createBeanDefEntry(ServerInfo.class, compositeDef, mongoRefName, eleSource, parserContext);
    createBeanDefEntry(MongoAdmin.class, compositeDef, mongoRefName, eleSource, parserContext);

    parserContext.registerComponent(compositeDef);

}
Sign up to request clarification or add additional context in comments.

1 Comment

Yes, when I create those beans manually, the MBeans show up in the JConsole. Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.