lhotari commented on code in PR #24020:
URL: https://github.com/apache/pulsar/pull/24020#discussion_r1976922991


##########
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/DeadLetterPolicy.java:
##########
@@ -62,4 +63,16 @@ public class DeadLetterPolicy implements Serializable {
      * to be created.
      */
     private String initialSubscriptionName;
+
+    /**
+     * Function to build the producer for the retry letter topic.
+     * The input parameter is the topic name.
+     */
+    private Function<String, ProducerBuilder<byte[]>> 
retryLetterProducerBuilder;
+
+    /**
+     * Function to build the producer for the dead letter topic.
+     * The input parameter is the topic name.
+     */
+    private Function<String, ProducerBuilder<byte[]>> 
deadLetterProducerBuilder;

Review Comment:
   > Adding `ProducerBuilderContext` is good.
   > But `ProducerBuilderCustomizer` is unnecessary, and the grammar is 
incorrect.
   > `void customize(ProducerBuilderContext context, ProducerBuilder<byte[]> 
producerBuilder);`
   > should be changed to 
   > `ProducerBuilder<byte[]> customize(ProducerBuilderContext context);`
   > 
   > I prefer to use `Function<ProducerBuilderContext, 
ProducerBuilder<byte[]>>`, which reduce the burden of understanding new 
interface `ProducerBuilderCustomizer`. WDYT, @lhotari @BewareMyPower @nodece 
@dao-jun
   
   The reason why both the context and builder are passed are due to the fact 
that the runtime will preconfigure the builder and the customizer will only 
override settings.
   
   One possibility would be to also return a builder so that the builder 
instance could be completely switched.
   
   This would be a way to support different use cases. If you'd replace the 
builder, you could even produce to a different cluster with a producer builder 
created from a different pulsar 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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to