繁体   English   中英

Spring boot,apache camel和hawtio:无法向端点发送消息

[英]Spring boot , apache camel and hawtio: cannot send message to endpoint

我正在尝试使用apache camel在一个spring-boot应用程序中集成hawtio。 我按照Spring-Boot Embedded Wars添加了HawtioConfiguration, 如何在带有嵌入式tomcat的spring boot应用程序中运行hawt.io (除了kubeservice和kubepod,它们不在io.hawt.web包中)

所以,这是有效的,直到我尝试从hawtio接口手动发送消息到直接端点( http:// localhost:8080 / hawtio / index.html#/ camel / sendMessage?tab = camel&nid = root -org.apache.camel-camel-1-endpoints-%22direct:%2F%2Fdummy%22 )。 出现以下警告,并且不发送任何消息:

Camel does not support sending to this endpoint.

那么,我忘了什么吗? 这是我的设置:springboot 1.3.3.RELEASE具有以下依赖项:

    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-spring-boot-starter</artifactId>
        <version>2.17.0</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jdbc</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jersey</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-actuator</artifactId>
    </dependency>

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>io.hawt</groupId>
        <artifactId>hawtio-springboot</artifactId>
        <version>1.4.64</version>
    </dependency>
    <dependency>
        <groupId>io.hawt</groupId>
        <artifactId>hawtio-core</artifactId>
        <version>1.4.64</version>
    </dependency>

和Application.java:

@SpringBootApplication
@EnableHawtio
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
public class Application {

    @Autowired
    private ServletContext servletContext;

    public static void main(String[] args) {
         System.setProperty(AuthenticationFilter.HAWTIO_AUTHENTICATION_ENABLED, "false");
        SpringApplication.run(Application.class, args);
    }
    @PostConstruct
    public void init() {
        final ConfigManager configManager = new ConfigManager();
        configManager.init();
        servletContext.setAttribute("ConfigManager", configManager);
    }
}

谢谢 !

编辑:使用hawtio作为独立的应用程序并连接到springboot工作正常

edit2:继续前进,我将hawtio用作另一个项目(相同版本)的战争,部署在tomcat 7上。同样的问题,无法发送到直接端点。 去搞清楚。

使用hawtio作为战争的选项非常适合使用弹簧靴和骆驼的应用程序,我已经成功使用它。 检查hawtio github代码示例,它包含很好的示例来尝试https://github.com/hawtio/hawtio

此外,我将与使用hawtio wat或maven插件的样本分享我的github链接。

我遇到了同样的问题:我无法使用hawt.io发送到直接端点(也没有任何其他端点)。 也许它是hawt.io中的一般Bug /未实现的功能?

但是,以下是可能的:

  • 复制端点URL
  • 在hawt.io中选择上下文节点
  • 点击“操作”
  • 使用sendStringBody(java.lang.String,java.lang.String)方法将字符串发送到该端点
  • 第一个参数是您可以粘贴的端点URI

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM