首页 > 解决方案 > camel mbean 管理对象默认不出现

问题描述

我使用camel 3.3.0和spring boot 2.3.1。考虑到camel路由的文档camel mbeans管理对象应该默认出现,但它不会发生。我尝试使用 jmx 将所有属性添加到 application.properties,但它也没有帮助。应用程序属性

camel.component.jmx.customizer.enabled=true
camel.springboot.jmx-enabled=true
camel.component.jmx.enabled=true

我希望org.apache.camel在 Java Mission Control 中看到包,但我没有。我有一个旧项目。2.xx 一切正常。我做错了什么?

pom.xml

..............................
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.3.1.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
..............................
<properties>
    <java.version>11</java.version>
</properties>
..............................
<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-spring-boot-starter</artifactId>
    <version>3.3.0</version>
</dependency>
<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-jmx-starter</artifactId>
    <version>3.3.0</version>
</dependency>
..................................

DemoApplication.java

@SpringBootApplication
public class DemoApplication extends RouteBuilder {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

    @Override
    public void configure() throws Exception {
        from("activemq:queue:test").log("message from test");
    }

}

标签: spring-bootapache-cameljmxspring-camelspring-jmx

解决方案


您需要添加camel-managementJAR 作为依赖项才能启用 Camel JMX。

它还记录在升级指南中:https ://camel.apache.org/manual/latest/camel-3x-upgrade-guide-3_1.html#_spring_boot_jmx


推荐阅读