Hi, You need to implement org.apache.kafka.common.serialization.Serializer, org.apache.kafka.common.serialization.Deserializer interfaces. Encoder, Decoder interfaces are for older clients.
Example code: https://github.com/omkreddy/kafka-example s/tree/master/consumer/src/main/java/kafka/examples/common/serialization On Tue, Mar 29, 2016 at 8:24 AM, Ratha v <vijayara...@gmail.com> wrote: > Hi all; > > I have written my custom serialiser/deserializer to publish/consume my java > bean objects. > However i get class nor found exception for "kafka.serializer" packages. > Can someone point me which class i have to use to implement my > custom serializer in kafka 0.9.x? > > import kafka.serializer.Decoder; > import kafka.serializer.Encoder; > import kafka.utils.VerifiableProperties; > public class FileSerializer implements Encoder<File>, Decoder<File> { > > public FileSerializer() { > > } > > public RawFileSerializer(VerifiableProperties verifiableProperties) { > /* This constructor must be present for successful compile. */ > } > > @Override > public byte[] toBytes(File file) { > .... > > } > > @Override > public File fromBytes(byte[] fileContent) { > .... > return (File) obj; > } > > } > > > I have added following pom dependency. > > <dependency> > > <groupId>org.apache.kafka</groupId> > > <artifactId>kafka-clients</artifactId> > > <version>0.9.0.0</version> > > </dependency> > > > Thanks > -- > -Ratha > http://vvratha.blogspot.com/ >