Reputation: 11
In our usecase currently we send messages one by one [ not in batch ] to maintain incoming order sequence while sending around more than 5000 messages one by one or sending a single message using kafkatemplate send method we are getting below error message
Exception while sending record to Kafka: Invalid value software.amazon.msk.auth.iam.IAMClientCallbackHandler for configuration sasl.client.callback.handler.class: Class software.amazon.msk.auth.iam.IAMClientCallbackHandler could not be found."}
org.apache.kafka.common.config.ConfigException: Invalid value software.amazon.msk.auth.iam.IAMClientCallbackHandler for configuration sasl.client.callback.handler.class: Class software.amazon.msk.auth.iam.IAMClientCallbackHandler could not be found.
Out of 5000 records around 500 messages will be pushed to kafka and rest of the messages will be failed due to above error. We use aws managed kafka service from aws which is IAM enabled. aws-msk-iam-auth - 1.1.6 jar [ Observed same issue with 1.1.5 ] Producer config properties producerConfig.put("security.protocol","SASL_SSL"); producerConfig.put("sasl.mechanism","AWS_MSK_IAM"); producerConfig.put("sasl.jaas.config","software.amazon.msk.auth.iam.IAMLoginModule required;"); producerConfig.put("sasl.client.callback.handler.class","software.amazon.msk.auth.iam.IAMClientCallbackHandler"); Tried with adding aws-msk-iam-auth explicitly in the classpath.
Any help/suggestion will be helpful.
Upvotes: 0
Views: 624
Reputation: 99
I fixed the same issue thanks to this response
I twas a bit unclear, but the solution is specifically this producerConfig.put("sasl.client.callback.handler.class",IAMClientCallbackHandler.class);
Notice the IAMClientCallbackHandler.class
instead of "software.amazon.msk.auth.iam.IAMClientCallbackHandler"
Upvotes: 0
Reputation: 23
Try this:
import software.amazon.msk.auth.iam.IAMClientCallbackHandler;
producerConfig.put("security.protocol","SASL_SSL");
producerConfig.put("sasl.mechanism","AWS_MSK_IAM");
producerConfig.put("sasl.jaas.config","software.amazon.msk.auth.iam.IAMLoginModule required;");
producerConfig.put("sasl.client.callback.handler.class",IAMClientCallbackHandler.class);
it will work!
Upvotes: 1