You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Isabelle Giguère <ig...@opentext.com> on 2017/02/09 17:27:16 UTC

ConsumerInterceptor in Tomcat app

Hi;

We have recently begun to integrate Kafka into our product, using Kafka 0.10.1.0.  The an instance of org.apache.kafka.clients.consumer.KafkaConsumer is run from a Tomcat application.

When I first read about ConsumerInterceptor, that could possibly "mutate" records, it seemed like it could help solve our problem of formatting input, between Kafka and the rest of the process: just write an interceptor that transforms the data.

I tested a simple interceptor in a KafkaConsumer run from a main.  I drop the interceptor implementation in the same lib folder that holds the Kafka jars, configure interceptor.classes, start the process, and it works, I get records transformed by the interceptor.

But in the Tomcat application, the effect of adding an interceptor is that the KafkaConsumer closes itself just after starting.  I tried placing the interceptor jar in ${catalina_home}/lib, or in ${catalina_home}/webapps/ROOT/WEB-INF/lib, but to no avail.

What did I miss?

Thanks for any feedback;
Isabelle