ProducerConfig producerConfig = new ProducerConfig(props);
ProducerMetadata<Integer, byte[]> producerMetadata = new ProducerMetadata<Integer, byte[]>(
topicName);
producerMetadata.setValueEncoder(new DefaultEncoder(null));
producerMetadata.setValueClassType(byte[].class);
producerMetadata.setKeyEncoder(new IntegerEncoderDecoder(null));
producerMetadata.setKeyClassType(Integer.class);
final Producer<Integer, byte[]> producer = new Producer<Integer, byte[]>(producerConfig);