Implementation:Apache Dolphinscheduler ITaskExecutorEventListener Callbacks
| Knowledge Sources | |
|---|---|
| Domains | Distributed_Systems, Event_Processing |
| Last Updated | 2026-02-10 00:00 GMT |
Overview
Concrete tool for tracking task lifecycle state changes via the ITaskExecutorEventListener RPC interface with typed lifecycle event callbacks.
Description
ITaskExecutorEventListener is an @RpcService interface with seven @RpcMethod callbacks, one for each lifecycle event type. The worker calls these methods via RPC proxy to notify the master of state transitions. Each event carries the task instance ID and state-specific data. The master's implementation updates the workflow DAG, triggers downstream tasks on success, or handles failure/recovery.
Usage
The listener is implemented by the master server and registered as an RPC service. Workers call it via the standard RPC proxy mechanism (Clients.withService()). Application code does not call these methods directly.
Code Reference
Source Location
- Repository: dolphinscheduler
- File: dolphinscheduler-extract/dolphinscheduler-extract-master/src/main/java/org/apache/dolphinscheduler/extract/master/ITaskExecutorEventListener.java (L30-52)
Signature
@RpcService
public interface ITaskExecutorEventListener {
@RpcMethod
void onTaskExecutorDispatched(
TaskExecutorDispatchedLifecycleEvent event);
@RpcMethod
void onTaskExecutorRunning(
TaskExecutorStartedLifecycleEvent event);
@RpcMethod
void onTaskExecutorSuccess(
TaskExecutorSuccessLifecycleEvent event);
@RpcMethod
void onTaskExecutorFailed(
TaskExecutorFailedLifecycleEvent event);
@RpcMethod
void onTaskExecutorKilled(
TaskExecutorKilledLifecycleEvent event);
@RpcMethod
void onTaskExecutorPaused(
TaskExecutorPausedLifecycleEvent event);
@RpcMethod
void onTaskExecutorRuntimeContextChanged(
TaskExecutorRuntimeContextChangedLifecycleEvent event);
}
Import
import org.apache.dolphinscheduler.extract.master.ITaskExecutorEventListener;
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| TaskExecutorDispatchedLifecycleEvent | Event DTO | Yes | Task accepted by worker |
| TaskExecutorStartedLifecycleEvent | Event DTO | Yes | Execution begun |
| TaskExecutorSuccessLifecycleEvent | Event DTO | Yes | Completed successfully |
| TaskExecutorFailedLifecycleEvent | Event DTO | Yes | Execution failed |
| TaskExecutorKilledLifecycleEvent | Event DTO | Yes | Task killed |
| TaskExecutorPausedLifecycleEvent | Event DTO | Yes | Task paused |
| TaskExecutorRuntimeContextChangedLifecycleEvent | Event DTO | No | Progress/log update |
Outputs
| Name | Type | Description |
|---|---|---|
| Updated task state | DB record | Task instance state updated in master's workflow DAG |
| Downstream triggers | Events | Ready downstream tasks queued for dispatch |
| Workflow completion | State change | Workflow marked complete when all tasks finished |
Usage Examples
Worker Reporting Success
// In PhysicalTaskExecutor after successful execution
ITaskExecutorEventListener listener = Clients
.withService(ITaskExecutorEventListener.class)
.withHost(masterAddress);
listener.onTaskExecutorSuccess(
TaskExecutorSuccessLifecycleEvent.builder()
.taskInstanceId(taskInstanceId)
.build()
);
Worker Reporting Failure
listener.onTaskExecutorFailed(
TaskExecutorFailedLifecycleEvent.builder()
.taskInstanceId(taskInstanceId)
.build()
);