Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Apache Dolphinscheduler WorkflowEngine Start

From Leeroopedia


Knowledge Sources
Domains Workflow_Orchestration, Distributed_Systems
Last Updated 2026-02-10 00:00 GMT

Overview

Concrete tool for orchestrating workflow execution through the WorkflowEngine which coordinates CommandEngine, WorkflowEventBusCoordinator, WorkerGroupDispatcherCoordinator, and LogicTaskEngineDelegator.

Description

WorkflowEngine is a Spring @Component that serves as the master server's execution engine. It holds references to four sub-engines via @Autowired injection and coordinates their startup and shutdown in the correct order. The start() method activates sub-engines sequentially, and close() shuts them down in reverse order to ensure clean termination.

Usage

Automatically started by the master server's Spring application context. Not invoked directly.

Code Reference

Source Location

  • Repository: dolphinscheduler
  • File: dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/WorkflowEngine.java (L29-58)

Signature

@Component
public class WorkflowEngine implements AutoCloseable {
    @Autowired
    private CommandEngine commandEngine;
    @Autowired
    private WorkflowEventBusCoordinator workflowEventBusCoordinator;
    @Autowired
    private WorkerGroupDispatcherCoordinator workerGroupDispatcherCoordinator;
    @Autowired
    private LogicTaskEngineDelegator logicTaskEngineDelegator;

    public void start();    // starts all sub-engines in order
    @Override
    public void close();    // closes all sub-engines in reverse order
}

Import

import org.apache.dolphinscheduler.server.master.engine.WorkflowEngine;

I/O Contract

Inputs

Name Type Required Description
Commands DB records Yes Command records in t_ds_command table (polled by CommandEngine)

Outputs

Name Type Description
WorkflowInstances DB records Created from commands, tracks execution state
Task dispatches RPC calls Tasks dispatched to workers via WorkerGroupDispatcherCoordinator

Usage Examples

Master Server Bootstrap

// In the master server's main application class
@SpringBootApplication
public class MasterServer {
    @Autowired
    private WorkflowEngine workflowEngine;

    @PostConstruct
    public void run() {
        workflowEngine.start();
        // Master is now processing commands and dispatching tasks
    }

    @PreDestroy
    public void close() {
        workflowEngine.close();
    }
}

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment