当前位置: 首页 > 知识库问答 >
问题:

Spring Boot、apache camel和hawtio:无法向终结点发送消息

徐鑫鹏
2023-03-14

我正在尝试使用apache camel将hawtio集成到spring boot应用程序中。我关注Spring Boot Embedded Wars,并从如何运行hawt中添加了HawtioConfiguration。带有嵌入式tomcat的spring boot应用程序中的io(不在io.hawt.web包中的kubeservice和kubepod除外)

所以,这是可行的,直到我尝试手动从hawtio接口向直接endpoint发送消息(http://localhost:8080/hawtio/index.html#/camel/sendMessage?tab=camel

Camel does not support sending to this endpoint.

我忘了什么吗?这是我的设置:springboot 1.3.3。发布时具有以下依赖项:

    <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用作另一个部署在Tomcat7上的项目(同一版本)的战争。同样的问题,无法发送到直接endpoint。想想看吧

共有2个答案

鲁淇
2023-03-14

我也有同样的问题:我不能使用hawt。io发送到直接endpoint(或任何其他endpoint)。也许这是hawt中的一个通用Bug/未实现的特性。伊奥?

然而,以下情况是可能的:

  • 复制endpointURL
  • 选择hawt.io中的上下文节点
  • 点击"操作"
  • 使用方法sendStringBody(java.lang.String,java.lang.String)将字符串发送到该终结点
  • 第一个参数是可以粘贴的endpointURI
闾丘书
2023-03-14

使用hawtio作为war的选项与使用spring boot和camel的应用程序配合得非常好,我已经成功地使用了它。查看hawtio github代码示例,它包含了很好的示例https://github.com/hawtio/hawtio

我还将与使用hawtio wat或作为maven插件的示例分享我的github链接。

 类似资料:
  • 我想使用SpringBoot向ActiveMQ队列发送消息。应用程序应在发送后终止,但仍保持活动状态。 这是我的申请代码: 在没有任何父节点的情况下使用以下依赖项(Maven): 和一行

  • 我的代码如下:, 从服务器通知FCM(C#) 我对上述要求的答复 {"multicast_id":5002368547300,"成功": 1,"失败": 0,"canonical_ids": 0,"结果":[{"message_id":"0:14200031 c4rrr5787蛋"}]} 我假设一旦FCM收到新的通知,它将把这些通知推送到各自的Android设备。 但对我来说,它不起作用。

  • 我正在使用kafka java客户端和kafka服务器。 我的代码: Kafka马纳格 当我的循环长度如果在1000左右(在类)时,我就能成功地向Kafka主题发送数据。 但当我的循环长度为1或小于10时,我无法向Kafka主题发送数据。注意我没有得到任何错误。 根据我的发现,如果我想发送一个单一的消息到Kafka主题,根据这个程序我得到了成功的消息,但从来没有得到一个关于我的主题的消息。 但是如

  • 我已设置了一个 AWS SNS 系统,以向已按照本教程订阅主题的所有终端节点发送通知(我已在此处设置了 Firebase 云信使,而不是 GCM): https://docs.aws.amazon.com/mobile/sdkforxamarin/developerguide/sns.html 当应用运行时,一切按预期方式工作。我可以通过 AWS SNS 控制台发送消息,并且我将在我的终端节点(物

  • 我的机器人不能发送嵌入或常规文本信息,代码执行,但没有什么是发送在不和谐的通道。我遵循了JDA维基的设置,我不知道我做错了什么。 机器人登录码

  • 当我提交表单时,我在浏览器控制台中看到“emit”消息,所以我知道表单提交事件正在触发,但我没有在服务器上收到测试消息。客户端或服务器端似乎什么也没发生,“socket.emit”函数似乎什么也没做。 我做错了什么?