kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joel Koshy <jjkosh...@gmail.com>
Subject Re: producer encoder class api
Date Fri, 06 Sep 2013 18:00:58 GMT
> public class MyKafkaEncoder<MyType> implements Encoder<MyType> {
>   // This constructor is expected by the kafka producer, used by reflection
> *  public MyKafkaEncoder(VerifiableProperties props) {*
> *    // what can I do with this?*
> *  }*

You don't need to do anything with the argument - the producer config
class internally does a "verification" on it after the producer (and
serializer) has been instantiated to check if there are unused and/or
invalid configs - mainly to help the user detect a potential
misconfiguration. I agree that it is a bit unintuitive as a public API
- ideally it should just be a Properties map and do an internal
conversion to VerifiableProperties. However, the problem is that we
take a bag of properties in the ProducerConfig and pass those in to
the constructor of the serializer.

View raw message