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


##########
pip/pip-409.md:
##########
@@ -33,25 +33,88 @@ retry/dead letter topic.
 
 ## Design & Implementation Details
 
-- Add two new configurations in `DeadLetterPolicy`:
+- Add `ProducerBuilderContext` and `ProducerBuilderCustomizer` interface:
+```java
+public interface ProducerBuilderContext {
+    /**
+     * Returns the default name of topic for the dead letter or retry letter 
producer. This topic name is used
+     * unless the ProducerBuilderCustomizer overrides it.
+     *
+     * @return a {@code String} representing the input topic name
+     */
+    String getDefaultTopicName();
+
+    /**
+     * Returns the name of the input topic for which the dead letter or retry 
letter producer is being configured.
+     *
+     * @return a {@code String} representing the input topic name
+     */
+    String getInputTopicName();
+
+    /**
+     * Returns the name of the subscription for which the dead letter or retry 
letter producer is being configured.
+     *
+     * @return a {@code String} representing the subscription name
+     */
+    String getInputTopicSubscriptionName();
+}
+
+public interface ProducerBuilderCustomizer {
+    /**
+     * Customize the given producer builder with settings specific to the 
topic context provided.
+     *
+     * @param context         the context containing information about the 
input topic and the subscription
+     * @param producerBuilder the producer builder instance to be customized
+     */
+    void customize(ProducerBuilderContext context, ProducerBuilder<byte[]> 
producerBuilder);

Review Comment:
   I'm fine with the customizer approach without allowing other use cases such 
as replacing the producer builder. That could be added later if needed, without 
breaking the API.



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