Sherwin Chiu created KAFKA-7585:
-----------------------------------

             Summary: Avoid classloader when passing serializers to 
KafkaProducer constructors
                 Key: KAFKA-7585
                 URL: https://issues.apache.org/jira/browse/KAFKA-7585
             Project: Kafka
          Issue Type: Improvement
          Components: producer 
    Affects Versions: 2.0.0
            Reporter: Sherwin Chiu


When using 
{quote}{{public KafkaProducer(Properties properties, Serializer<K> 
keySerializer, Serializer<V> valueSerializer)}}
{quote}
I was surprised to run into the following error.
{quote}{{Class org.apache.kafka.common.serialization.StringSerializer could not 
be found.}}
{quote}
Is there a reason why KafkaProducer needs to reload the class I already passed 
in?  I was expecting this constructor to function similarly to 
{quote}{{public KafkaProducer(Map<String, Object> configs, Serializer<K> 
keySerializer, Serializer<V> valueSerializer)}}
{quote}
Why not convert/cast the Properties to a Map<String, Object> and add the 
serializers just like the Map config constructor?  I see that it's trying to 
keep the Properties construct.  Is there a reason for this?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to