You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Sherwin Chiu (JIRA)" <ji...@apache.org> on 2018/11/02 19:04:00 UTC

[jira] [Created] (KAFKA-7585) Avoid classloader when passing serializers to KafkaProducer constructors

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)