I am trying add a Interceptor to do validation for the messages published by the producer to Kafka topic. I need to do few validations in addition to Schema validation which is performed by Kafka topic. Steps I have followed are as follows.
- I have written a Java class extending ProducerInterceptor Interface.
- Compiled the class and created a jar file which is placed in a folder included in the classpath.
- Added intercetors.classes= classname to producer.properties inside Kafka installation.
But when I publish message to the topic the custom interceptor class which I have written is not invoked. ( I am not getting any errors also. Messages are published to topic perfectly).
I haver referred https://cwiki.apache.org/confluence/display/KAFKA/KIP-42%3A+Add+Producer+and+Consumer+Interceptors
Please advice on this.