【问题标题】:Messages are not getting consumed消息没有被消费
【发布时间】:2021-10-11 14:23:31
【问题描述】:

我在带有 Camel 实现的 Spring Boot 的 application.properties 文件中添加了以下配置,但消息没有被消耗。我是否缺少任何配置?使用 kafka 协议和 Camel 从 Azure 事件中心实现消费者的任何指针?

bootstrap.servers=NAMESPACENAME.servicebus.windows.net:9093
security.protocol=SASL_SSL
sasl.mechanism=PLAIN
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="$ConnectionString" password="{YOUR.EVENTHUBS.CONNECTION.STRING}";

路线如下:

from("kafka:{{topicName}}?brokers=NAMESPACENAME.servicebus.windows.net:9093" )
                .log("Message received from Kafka : ${body}"); 

【问题讨论】:

    标签: apache-kafka apache-camel azure-eventhub spring-camel


    【解决方案1】:

    我找到了这个问题的解决方案。由于我使用的是 Spring Boot Auto 配置(camel-kafka-starter),因此必须修改 application.properties 文件中的条目,如下所示:

    camel.component.kafka.brokers=NAMESPACENAME.servicebus.windows.net:9093
    camel.component.kafka.security-protocol=SASL_SSL
    camel.component.kafka.sasl-mechanism=PLAIN
    camel.component.kafka.sasl-jaas-config =org.apache.kafka.common.security.plain.PlainLoginModule required username="$ConnectionString" password="{YOUR.EVENTHUBS.CONNECTION.STRING}";
    

    使用 Kafka 协议的 Azure 事件中心的消费者路由将如下所示:

    from("kafka:{{topicName}}")
    .log("Message received from Kafka : ${body}"); 
    

    希望此解决方案有助于使用 Kafka 协议在 Camel 中使用 Azure 事件中心中的事件

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-06-27
      • 1970-01-01
      • 2020-08-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多