private static void setDeserializer ( Properties props ) { final String deSerName = ByteArrayDeserializer . class . getName ( ) ; Object keyDeSer = props . get ( ConsumerConfig . KEY_DESERIALIZER_CLASS_CONFIG ) ; Object valDeSer = props . get ( ConsumerConfig . VALUE_DESERIALIZER_CLASS_CONFIG ) ; if ( keyDeSer != null && ! keyDeSer . equals ( deSerName ) ) { LOG . warn ( "Ignoring configured key DeSerializer ({})" , ConsumerConfig . KEY_DESERIALIZER_CLASS_CONFIG ) ; } if ( valDeSer != null && ! valDeSer . equals ( deSerName ) ) { LOG . warn ( "Ignoring configured value DeSerializer ({})" , ConsumerConfig . VALUE_DESERIALIZER_CLASS_CONFIG ) ; } props . put ( ConsumerConfig . KEY_DESERIALIZER_CLASS_CONFIG , deSerName ) ; props . put ( ConsumerConfig . VALUE_DESERIALIZER_CLASS_CONFIG , deSerName ) ; }
Makes sure that the ByteArrayDeserializer is registered in the Kafka properties .