Search code examples
javaapache-kafkaspring-kafka

Implementing SSL on the spring-kafka Consumer


I am using below configs in my container factory. After i add this config, i am not able to see anything being consumed by the spring-kafka consumer. Is there a standard way of setting the SSL for kafka consumer using spring. When i remove these configs, i am able to get the messages and consumer them.

config.put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, "SSL")
config.put("ssl.keystore.location", "location_to/abc.keystore.jks"); //
config.put("ssl.keystore.password", "pwd1122");
config.put("ssl.truststore.location", "location_to/serv.truststore.jks");
config.put("ssl.truststore.password", "pwd11223");

Solution

  • When i remove these configs, i am able to get the messages and consume[r] them.

    That simply means the broker is not configured for SSL - the client and server have to agree to use SSL or not.

    If the broker is configured with an SSL listener, it must be on another port.