Thanks Jun. Appreciate your quick response. Once the encoder is instantiated, is it possible to get a reference to it? I tried to see if I could get it trough anything that the Producer exposes. Apparently, not...
-abe On Thu, Oct 9, 2014 at 9:28 PM, Jun Rao <jun...@gmail.com> wrote: > The encoder is instantiated once when the producer is constructed. > > Thanks, > > Jun > > On Thu, Oct 9, 2014 at 6:45 PM, Abraham Jacob <abe.jac...@gmail.com> > wrote: > > > Hi All, > > > > I wanted to get some clarification on Kafka's Encoder/Decoder usage. > > > > Lets say I want to implement a custom Encoder. > > > > public class CustomMessageSerializer implements Encoder<MyCustomObject> > { > > > > @Override > > public byte[] toBytes(String arg0) { > > // serialize the MyCustomObject > > return serializedCustomObject ; > > } > > } > > > > > > > > now in my producer properties I can set serializer.class to > > CustomMessageSerializer > > > > > > Now, i presume that when Kafka is ready to send the message, it will run > > the message through the CustomMessageSerializer. > > > > My question is - for each message (list of messages) that is to be sent, > > does a new instance of CustomMessageSerializer instantiated, or is it > that, > > it instantiates the CustomMessageSerializer once, and calls toBytes(...) > > for every message....? > > > > > > Also, as a side note does Kafka support Kryo serializer? > > > > Regards, > > -Jacob > > > -- ~