Exemplo n.º 1
0
 private static Properties addDeserializerToConfig(
     Properties properties, Deserializer<?> keyDeserializer, Deserializer<?> valueDeserializer) {
   Properties newProperties = new Properties();
   newProperties.putAll(properties);
   if (keyDeserializer != null)
     newProperties.put(
         ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, keyDeserializer.getClass().getName());
   if (keyDeserializer != null)
     newProperties.put(
         ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, valueDeserializer.getClass().getName());
   return newProperties;
 }
Exemplo n.º 2
0
 private static Map<String, Object> addDeserializerToConfig(
     Map<String, Object> configs,
     Deserializer<?> keyDeserializer,
     Deserializer<?> valueDeserializer) {
   Map<String, Object> newConfigs = new HashMap<String, Object>();
   newConfigs.putAll(configs);
   if (keyDeserializer != null)
     newConfigs.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, keyDeserializer.getClass());
   if (keyDeserializer != null)
     newConfigs.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, valueDeserializer.getClass());
   return newConfigs;
 }