-
Notifications
You must be signed in to change notification settings - Fork 5k
[Feature][spi,plugin,alert,dao] Add DolphinScheduler SPI module, Plugin database schema, PluginLoader. Alert SPI and Alert Plugin basic code development. Improvement of mail Alert Plugin. #3189
Description
A subtask of #3049
Database table design
Plugin definition table t_ds_plugin_define
id,
plugin_name,
plugin_type
plugin_params,
create_time,
update_time
Plugin instance table t_ds_alert_plugin_instance
id
plugin_define_id,
plugin_instance_params
create_time,
update_time
Interface design
incubator-dolphinscheduler-maven-plugin
A custom maven plug-in, its role is to automatically check the spi and plug-in related dependencies, and can support adding dolphinscheduler-plugin logo in the pom file to allow DS to automatically generate related META-INF/services files at compile time. For detailed information, please refer to: https://github.com/gaojun2048/incubator-dolphinscheduler-maven-plugin
SPI
DolphinSchedulerPlugin
DS plug-in top-level interface, all DS plug-ins must implement this interface
AlertChannelFactory
Alert plug-in factory interface. All alert plug-ins need to implement this interface. This interface is used to define the name of the alert plug-in and the required parameters. The create method is used to create a specific alert plug-in instance.
AlertChannel
The interface of the alert plug-in. The alert plug-in needs to implement this interface. There is only one method process in the interface. The upper alert system will use this method and obtain the return information of the alert through the AlertResult returned by the method.
AlertData
alert content information, including id, title, content, log.
AlertInfo
For alert-related information, when an upper-layer system calls an alert plug-in instance, the instance of this type is passed into the specific alert plug-in through the process method. It contains the alert content AlertData and the parameter information filled in by the front end of the alert plug-in instance called.
AlertResult
The alert plugin sends alert return information.
org.apache.dolphinscheduler.spi.params
Under this package is the plug-in parameter definition. Our front-end uses the front-end library http://www.form-create.com, which can dynamically generate the front-end based on the parameter list json returned by the plug-in definition Ui.
Under this package, we currently only encapsulate RadioParam, InputParam, and PasswordParam, which are used to define text type parameters, radio parameters, and password type parameters, respectively.
PluginParams This class is the base class for all parameters, and these classes inherit from RadioParam. Each DS alert plugin will return a list of AbsPluginParams in the implementation of AlertChannelFactory.
org.apache.dolphinscheduler.alert.plugin
Under this package is the relevant code for the DS Alert module to load the Alert plug-in. In the AlertChannelManager class, we also need to save the loaded plugin to the database's plugin_define table.