Default serializer for kafka 0.8.2.0
apache-kafka
Solution
The earlier versions of Kafka came with default serializer but that created lot of confusion.
With 0.8.2, you would need to pick a serializer yourself from StringSerializer or ByteArraySerializer that comes with API or build your own.
The API serializers can be found at StringSerializer: http://kafka.apache.org/082/javadoc/org/apache/kafka/common/serialization/StringSerializer.html ByteArraySerializer: http://kafka.apache.org/082/javadoc/org/apache/kafka/common/serialization/ByteArraySerializer.html
So, your solution would be to use one of the below options if you are looking to use default Serializers.
props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
or
props.put("key.serializer", "org.apache.kafka.common.serialization.ByteArraySerializer");
Problem
I am setting up Kafka producer using their new KafkaProducer API and getting following error ``` Exception in thread "main" org.apache.kafka.common.config.ConfigException: Missing required configuration "key.serializer" which has no default value. at org.apache.kafka.common.config.ConfigDef.parse(ConfigDef.java:124) at org.apache.kafka.common.config.AbstractConfig.<init>(AbstractConfig.java:48) at org.apache.kafka.clients.producer.ProducerConfig.<init>(ProducerConfig.java:235) at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:129) at com.kafka.producer.App.KafkaProducer(App.java:43) at com.kafka.producer.App.main(App.java:33) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) ``` There seems to be no default serializer and the documentation at http://kafka.apache.org/documentation.html#newproducerconfigs and I do not see possible values. This question is for Kafka 0.8.2.0 version