You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by michael e <mi...@outlook.fr> on 2021/06/22 12:59:12 UTC

Unable to connect to Kafka from Karaf (4.3.1) with Camel 3.7

Hello,

I facing with weird situation i have a very simple Camel route that trie to consume Kafka topic, my route work well when running unit test, but when i deply to Karaf nothing happen i just get some logs that say the route ready to consume but then i get anything from Kafka.


@Override
public void configure() throws Exception {
    from(kafka())
            .routeId(INPUT_BROKER_ROUTE_ID)

            .log("KAFKA BODY ::: ${body}");
}

private static String kafka() {
    return new StringBuilder("kafka:")
            .append("{{kafka.topic}}")
            .append("?brokers=")
            .append("{{kafka.brokers}}")
            .append("&groupId=")
            .append("{{kafka.group.id}}")
            .append("&clientId=")
            .append("myClientId")
            .append("&autoOffsetReset=")
            .append("earliest")
            .append("&saslMechanism=")
            .append("PLAIN")
            .append("&securityProtocol=")
            .append(SASL_PLAINTEXT)
            .append("&saslJaasConfig=")
            .append(saslJaasConfig())
            .toString();
}

private static String saslJaasConfig() {
    return new StringBuilder(format("%s", PlainLoginModule.class.getCanonicalName()))
            .append(' ').append("required").append(' ')
            .append("username=")
            .append('"').append("{{kafka.username}}").append('"')
            .append(' ')
            .append("password=")
            .append('"').append("{{kafka.password}}").append('"')
            .append(';')
            .toString();
}

I do some tests and i see that even i put wrong username or password the logs remains the same is look there is no real connection to Kafka.

Thanks for help.
Michael.