divijvaidya commented on code in PR #12010:
URL: https://github.com/apache/kafka/pull/12010#discussion_r854161094


##########
clients/src/main/java/org/apache/kafka/clients/producer/ProducerConfig.java:
##########
@@ -393,10 +394,14 @@ public class ProducerConfig extends AbstractConfig {
                                         
MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION_DOC)
                                 .define(KEY_SERIALIZER_CLASS_CONFIG,
                                         Type.CLASS,
+                                        ConfigDef.NO_DEFAULT_VALUE,
+                                        new ConfigDef.NonNullValidator(),

Review Comment:
   > I'm unclear on how/why we'd want to change `appendSerializerToConfig`, 
though?
   
   What I wanted to convey was that if we are modifying the contract to assert 
that serializer cannot be null at any time in the lifecycle of the `*Config` 
object, then we need to throw an IllegalArgument exception (in the spirit of 
fail fast) from `appendSerializerToConfig` if the serializer is null instead of 
silently ignoring the null input.
   
   Separately, echoing what Chris said above, today, it is 
[possible](https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java#L272)
 to create a `ProducerConfig` with key/value serializer set to `null`. After 
this change, it will not be possible to do so as it will throw an exception. 
@RivenSun2, can you please help me understand how these use cases with `null` 
serializers won't be impacted when they upgrade to the version containing this 
change?
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to