ruanwenjun commented on code in PR #15163:
URL: 
https://github.com/apache/dolphinscheduler/pull/15163#discussion_r1394388715


##########
dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/service/ListenerEventPostService.java:
##########
@@ -260,4 +261,39 @@ public void close() {
         log.info("Closed ListenerEventPostService...");
     }
 
+    public AlertChannel getPluginDefine(int pluginDefineId) {
+        Optional<AlertChannel> alertChannelOptional = 
alertPluginManager.getAlertChannel(pluginDefineId);
+        return alertChannelOptional.orElse(null);
+    }

Review Comment:
   ```suggestion
       public Optional<AlertChannel> getPluginDefine(int pluginDefineId) {
           return  alertPluginManager.getAlertChannel(pluginDefineId);
       }
   ```



##########
dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java:
##########
@@ -60,13 +61,17 @@ public static void main(String[] args) {
 
     @EventListener
     public void run(ApplicationReadyEvent readyEvent) {
-        log.info("Alert server is staring ...");
         alertPluginManager.start();
-        alertRegistryClient.start();
-        alertBootstrapService.start();
-        listenerEventPostService.start();
-        alertRpcServer.start();
-        log.info("Alert server is started ...");
+
+        if (this.getClass().getName()
+                .contains(((SpringApplication) 
readyEvent.getSource()).getMainApplicationClass().getName())) {
+            log.info("Alert server is staring ...");
+            alertRegistryClient.start();
+            alertBootstrapService.start();
+            listenerEventPostService.start();
+            alertRpcServer.start();
+            log.info("Alert server is started ...");
+        }

Review Comment:
   Why do this change? 



##########
dolphinscheduler-api/pom.xml:
##########
@@ -61,6 +61,11 @@
             <artifactId>dolphinscheduler-meter</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.dolphinscheduler</groupId>
+            <artifactId>dolphinscheduler-alert-server</artifactId>
+        </dependency>
+

Review Comment:
   It's not a good idea to import alert-server in api-server, you should 
exposed a rpc method `testSend`  in alert server, and api call this method to 
test.



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