devinbost commented on pull request #9987:
URL: https://github.com/apache/pulsar/pull/9987#issuecomment-804371892


   One of the challenges is that protobuf doesn't support null primitives, so 
it's not as simple as just checking the function config for a null and then 
using the corresponding WorkerConfig default if the function config property is 
null. If we just rely on the function config's default value for the default 
behavior, then there's no way for a cluster admin to change all the functions' 
behavior with one config change. (Instead, every function would need to be 
re-deployed.) 
   
   I suppose I could create a new kind of ProducerBuilder (such as 
ProducerBuilderWithDefaults) that would be passed an object with the Function 
defaults and the WorkerConfig's function defaults, and it would provide the 
logic for each builder method to check the Function default, and if it's set to 
the protobuf default value, then it assumes the Function default was equivalent 
to "null" and then uses the corresponding property on the object with the 
WorkerConfig's function defaults. 
   
   With that said, it doesn't look like each producer implementation uses 
pulsar.getProducerBuilder()... some of them use client.newProducer(..) (such as 
in PulsarSink, 
https://github.com/apache/pulsar/blob/master/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/sink/PulsarSink.java#L110),
 but I'm not sure we want to expose all that to the client. 


-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to