ChenSammi commented on code in PR #10318:
URL: https://github.com/apache/ozone/pull/10318#discussion_r3353188710


##########
hadoop-ozone/ozone-manager-plugins/src/main/java/org/apache/hadoop/ozone/om/eventlistener/OMEventListenerKafkaPublisher.java:
##########
@@ -56,10 +65,22 @@ public void initialize(OzoneConfiguration conf, 
OMEventListenerPluginContext plu
 
     this.kafkaClient = new KafkaClientWrapper(kafkaProps);
 
-    // TODO: these constants should be read from config
-    long kafkaServiceInterval = 2 * 1000;
-    long kafkaServiceTimeout = 300 * 1000;
+    long kafkaServiceInterval = conf.getTimeDuration(
+        KAFKA_SERVICE_INTERVAL_CONFIG, "2s", TimeUnit.MILLISECONDS);
+    long kafkaServiceTimeout = conf.getTimeDuration(
+        KAFKA_SERVICE_TIMEOUT_CONFIG, "5m", TimeUnit.MILLISECONDS);
 
+    Class<? extends OMEventListenerNotificationStrategy> strategyClass = 
conf.getClass(
+        NOTIFICATION_STRATEGY_CONFIG,
+        DEFAULT_NOTIFICATION_STRATEGY,
+        OMEventListenerNotificationStrategy.class);
+    try {
+      this.notificationStrategy = 
strategyClass.getDeclaredConstructor().newInstance();
+    } catch (Exception ex) {
+      LOG.error("Failed to instantiate notification strategy: {}. " +
+          "Falling back to NoOp strategy.", strategyClass, ex);
+      this.notificationStrategy = new 
NoOpOMEventListenerNotificationStrategy();

Review Comment:
   Ideally we should fail the OMEventListenerKafkaPublisher instead of fallback 
to  NoOpOMEventListenerNotificationStrategy to save OM resource, since with 
NoOpOMEventListenerNotificationStrategy, event is actually not working, but 
still consume OM process resource. 



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to