【问题标题】:Load01,Load05,Load15 attributes in apache camel jmx returns empty stringapache camel jmx中的Load01,Load05,Load15属性返回空字符串
【发布时间】:2025-12-10 14:25:02
【问题描述】:

我在 Spring Boot 应用程序中使用 Apache Camel (v2.19.1)。我想用 JMX MBean 监控应用程序。

我想从类“org.apache.camel.management.mbean.ManagedRoute”属性Load01、Load05等中找出特定“路由”的负载...

我得到空字符串作为 Load 属性的值。统计信息已启用。

请帮忙。

谢谢,

【问题讨论】:

    标签: apache-camel jmx


    【解决方案1】:

    您需要打开它。您可以在 JMX 文档中找到如何打开负载统计的详细信息:http://camel.apache.org/camel-jmx.html,例如设置loadStatisticsEnabled=true

    【讨论】:

    • 感谢您的回复。但是,如问题中所述,默认情况下会以某种方式启用统计信息。我使用 Jconsole 来监控 Mbean 的属性。 Jconsole 显示“StatisticsEnabled=true”。除非我看错了。
    • 还有另一个选项可以只打开加载,例如LoadStatistics。您还需要打开那个。
    • 谢谢,通过下面的代码,我设法看到了Load01、Load05、Load15中的一些值 DefaultCamelContext camelContext = (DefaultCamelContext) getContext(); camelContext.getManagementStrategy().getManagementAgent().setStatisticsLevel(ManagementStatisticsLevel.RoutesOnly); camelContext.getManagementStrategy().getManagementAgent().setLoadStatisticsEnabled(true);
    • 但是 Load01 等的值是负数。即使没有负载,数字部分也会不断增加。感谢任何帮助。