yingh0ng commented on issue #17156: URL: https://github.com/apache/dolphinscheduler/issues/17156#issuecomment-2982337881
@ruanwenjun This is my design, PTAL. ## Design Detail  ### AbstractMetadataEvent Extends the `IEvent`. Responsible for define the metadata event. The abstrace method is: ```java public abstract IMetadataEventType getEventType(); ``` Subclasses: - AbstractWorkflowMetadataEvent. Holding the `workflowDefinition`. Subclass: - WorkflowDefinitionUpdateEvent - WorkflowDefinitionReleaseEvent - WorkflowDefinitionOfflineEvent - AbstractDatasourceMetadataEventt. Holding the `Datasource`. Subclass: - DatasourceCreateEvent - DatasourceUpdateEvent - DatasourceDeleteEvent - AbstractProjectMetadataEventt. Holding the `Project`. Subclass: - ProjectCreateEvent - ProjectDeleteEvent ### IMetadataEventType The interface for define the event type. I will only add some common event type this time and their handlers will only print the log. Subclasses(enum): - WorkflowMetadataEventType - WORKFLOW_DEFINITION_UPDATE - WORKFLOW_DEFINITION_RELEASE - WORKFLOW_DEFINITION_OFFLINE - DatasourceMetadataEventType - DATASOURCE_CREATE - DATASOURCE_UPDATE - DATASOURCE_DELETE - ProjectMetadataEventType - PROJECT_CREATE - PROJECT_DELETE ### MetadataEventBus Extends the `AbstractDelayEventBus`. Responsible for accept and save the `AbstractMetadataEvent` . ### IMetadataEventHandler Responsible for handle the `AbstractMetadataEvent`. The fireworker will dispatch events to it by the event type match. Users can add their implementation to handle the event. The default implementations: - Workflow - WorkflowDefinitionUpdateHandler - WorkflowDefinitionReleaseHandler - WorkflowDefinitionOfflineHandler - Datasource - DatasourceCreateHandler - DatasourceUpdateHandler - DatasourceDeleteHandler - Project - ProjectCreateHandler - ProjectDeleteHandler All above handlers are only print the log in the default implementation. ### MetadataEventBusFireWorker It is a daemon thread that responsible for fire the events from eventBus and dipatch events to handlers by event type match. -- 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]
