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


##########
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/DeadLetterPolicy.java:
##########
@@ -62,4 +62,29 @@ public class DeadLetterPolicy implements Serializable {
      * to be created.
      */
     private String initialSubscriptionName;
+
+    /**
+     * Customizer for configuring the producer builder for the retry letter 
topic.
+     *
+     * <p>This field holds a function that allows the caller to customize the 
producer builder
+     * settings for the retry letter topic before the producer is created. The 
customization logic
+     * can use the provided context (which includes input topic and 
subscription details) to adjust
+     * configurations such as timeouts, batching, or message routing.
+     */
+    private ProducerBuilderCustomizer retryLetterProducerBuilderCustomizer = 
DEFAULT_PRODUCER_BUILDER_CUSTOMIZER;
+
+    /**
+     * Customizer for configuring the producer builder for the dead letter 
topic.
+     *
+     * <p>This field holds a function that allows the caller to customize the 
producer builder
+     * settings for the dead letter topic before the producer is created. 
Using the provided context,
+     * implementations can perform specific adjustments that ensure the dead 
letter queue operates
+     * with the appropriate configurations tailored for handling undeliverable 
messages.
+     */
+    private ProducerBuilderCustomizer deadLetterProducerBuilderCustomizer = 
DEFAULT_PRODUCER_BUILDER_CUSTOMIZER;
+
+    // keep compatibility with old configuration
+    private static final ProducerBuilderCustomizer 
DEFAULT_PRODUCER_BUILDER_CUSTOMIZER =
+            (context, builder) ->
+                    
builder.enableBatching(false).enableChunking(true).blockIfQueueFull(false);

Review Comment:
   Instead of having a default customizer, I'd suggest a solution where in the 
the runtime, the old configuration is always applied and then a user provider 
customizer is called if it has been set. If the user would like to change the 
defaults, they could do that in the customizer.



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