|
|
|
@ -30,6 +30,7 @@ import org.apache.dolphinscheduler.common.thread.Stopper;
|
|
|
|
|
import org.apache.dolphinscheduler.common.utils.PropertyUtils; |
|
|
|
|
import org.apache.dolphinscheduler.dao.AlertDao; |
|
|
|
|
import org.apache.dolphinscheduler.dao.DaoFactory; |
|
|
|
|
import org.apache.dolphinscheduler.dao.PluginDao; |
|
|
|
|
import org.apache.dolphinscheduler.dao.entity.Alert; |
|
|
|
|
import org.apache.dolphinscheduler.remote.NettyRemotingServer; |
|
|
|
|
import org.apache.dolphinscheduler.remote.command.CommandType; |
|
|
|
@ -47,7 +48,14 @@ import com.google.common.collect.ImmutableList;
|
|
|
|
|
* alert of start |
|
|
|
|
*/ |
|
|
|
|
public class AlertServer { |
|
|
|
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(AlertServer.class); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Plugin Dao |
|
|
|
|
*/ |
|
|
|
|
private PluginDao pluginDao = DaoFactory.getDaoInstance(PluginDao.class); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Alert Dao |
|
|
|
|
*/ |
|
|
|
@ -55,8 +63,6 @@ public class AlertServer {
|
|
|
|
|
|
|
|
|
|
private AlertSender alertSender; |
|
|
|
|
|
|
|
|
|
private static AlertServer instance; |
|
|
|
|
|
|
|
|
|
private AlertPluginManager alertPluginManager; |
|
|
|
|
|
|
|
|
|
private DolphinPluginManagerConfig alertPluginManagerConfig; |
|
|
|
@ -78,13 +84,19 @@ public class AlertServer {
|
|
|
|
|
|
|
|
|
|
public static final AlertServer getInstance() { |
|
|
|
|
return AlertServerHolder.INSTANCE; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private AlertServer() { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void checkTable() { |
|
|
|
|
if (!pluginDao.checkPluginDefineTableExist()) { |
|
|
|
|
logger.error("Plugin Define Table t_ds_plugin_define Not Exist . Please Create it First !"); |
|
|
|
|
System.exit(1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void initPlugin() { |
|
|
|
|
alertPluginManager = new AlertPluginManager(); |
|
|
|
|
alertPluginManagerConfig = new DolphinPluginManagerConfig(); |
|
|
|
@ -101,7 +113,7 @@ public class AlertServer {
|
|
|
|
|
try { |
|
|
|
|
alertPluginLoader.loadPlugins(); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
throw new RuntimeException("load Alert Plugin Failed !", e); |
|
|
|
|
throw new RuntimeException("Load Alert Plugin Failed !", e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -142,6 +154,7 @@ public class AlertServer {
|
|
|
|
|
*/ |
|
|
|
|
public void start() { |
|
|
|
|
PropertyUtils.loadPropertyFile(ALERT_PROPERTIES_PATH); |
|
|
|
|
checkTable(); |
|
|
|
|
initPlugin(); |
|
|
|
|
initRemoteServer(); |
|
|
|
|
logger.info("alert server ready start "); |
|
|
|
|