Search code examples
apache-kafkaapache-camelazure-eventhubspring-camel

Messages are not getting consumed


I have added the below configuration in application.properties file of Spring Boot with Camel implementation but the messages are not getting consumed. Am I missing any configuration? Any pointers to implement consumer from Azure event hub using kafka protocol and Camel ?

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}";

The route looks like this:

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

Solution

  • I found the solution for this issue. Since I was using the Spring Boot Auto configuration (camel-kafka-starter), the entry on the application.properties file had to be modified as given below:

    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}";
    

    The consumer route for the Azure event hub with Kafka protocol will look like this:

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

    Hope this solution helps to consume events from Azure event hub in Camel using Kafka protocol