pandaapo commented on code in PR #3867:
URL: https://github.com/apache/eventmesh/pull/3867#discussion_r1575956640


##########
eventmesh-storage-plugin/eventmesh-storage-kafka/src/main/java/org/apache/eventmesh/storage/kafka/producer/ProducerImpl.java:
##########
@@ -42,36 +41,20 @@
 
 @Slf4j
 @SuppressWarnings("deprecation")
-public class ProducerImpl {
+public class ProducerImpl extends AbstractProducer {
 
     private final KafkaProducer<String, CloudEvent> producer;
-    private final Properties properties = new Properties();
-    private final AtomicBoolean isStarted = new AtomicBoolean(false);
 
     public ProducerImpl(Properties props) {
+        super(props);
+        properties.clear();

Review Comment:
   Then I explain it in detail again.
   
   The following is the original logic of this method under Kafka module. You 
can see that only three items need to be set in `properties` object. Now after 
the unified abstraction, `properties` is first assigned a value, which is 
equivalent to setting more items. If I don't `clear()` first, it firstly 
disrupts the original logic, secondly causes data contamination, and thirdly, 
the additional unknown items set might lead to unnecessary and unknown problems.
   
   
https://github.com/apache/eventmesh/blob/9ce5dd6fd94d60d47358721a18eff0f50cd932ad/eventmesh-storage-plugin/eventmesh-storage-kafka/src/main/java/org/apache/eventmesh/storage/kafka/producer/ProducerImpl.java#L51-L56
   
   As for why RocketMQ and Pulsar modules don't need `clear()`, because it is 
consistent with their original logic.



-- 
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: issues-unsubscr...@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@eventmesh.apache.org
For additional commands, e-mail: issues-h...@eventmesh.apache.org

Reply via email to