Files
airflow/java-sdk/sdk/module.md
T
Jason(Zhe-You) Liu d4013cc2b5 Java SDK: Pick one of two tasks with a condition (#74438)
* Java SDK: Pick one of two tasks with a condition

A native Java Dag could only run every task it declared: it had no way to
let a task's result decide what runs next, so a Dag that loads only when
there are rows had to be split in two or fall back to a Python stub.

`DagDef.If` and `@Builder.If` declare a task whose boolean names the side
that runs; the other is skipped. The deciding task carries
`_can_skip_downstream`, so Airflow skips a cleared side again rather than
running it, and the SDK writes the `skipmixin_key` XCom before the skip, as
Python's SkipMixin does. It skips only the side not taken, so a task after
both sides needs a trigger rule such as `none_failed_min_one_success`.

`If` is capitalized because `if` is a Java keyword and `@Builder.If` reads
the same way. With no task id given, one is derived from the condition
class's simple name, so `HasRows.class` becomes `hasRows`.

The runtime reaches `SkipDownstreamTasks` through the transport client
only, never through the task-facing `Client`, so a task body cannot skip
tasks the Dag did not declare it may.

* Java SDK: Let a wiring view name a condition's sides in more than one call

* Java SDK: Reject a decider class registered as an ordinary task

* Java SDK: Name a condition's sides Then and Else

* Java SDK: Pin the order a condition skips and records what it skipped

* Java SDK: Drop the unused switch in the condition test's decider
2026-10-09 14:30:52 +08:00

3.8 KiB
Raw Blame History

Module sdk

The Apache Airflow Java SDK — author and run Airflow task implementations in JVM languages.

Language SDK compatibility matrix

Which Airflow TaskInstance states and capabilities the Java SDK currently supports. The normative meaning of each dimension is defined in the Language SDK conformance specification.

Min. Airflow version: 3.3 · supervisor schema: 2026-10-30

Dimension Tier Supported Since Notes
TaskInstance states
state: success MUST ✓ 3.3
state: failed MUST ✓ 3.3
state: up_for_retry MUST ✓ 3.3 RetryTask
state: skipped SHOULD ✗ – runtime does not emit TaskState skipped yet
state: deferred MAY ✗ – runtime does not emit DeferTask yet
state: up_for_reschedule MAY ✗ – runtime does not emit RescheduleTask yet
state: awaiting_input MAY ✗ – runtime does not emit AwaitInputTask yet
state: removed MAY ✓ 3.3
Runtime capabilities
capability: mixed-lang-stub-target MUST ✓ 3.3 @task.stub
capability: taskflow-binding MUST ✗ – bind @task.stub literal/XCom args to the native handler
capability: task-logging MUST ✓ 3.3 SLF4J + JPL bridged to the task log
capability: xcom-read-write MUST ✓ 3.3
capability: connection-read MUST ✓ 3.3
capability: variable-read-write MUST ✓ 3.3
capability: self-contained-bundle MUST ✓ 3.3 Airflow metadata embedded in the jar artifact
capability: retry-policy MAY ✗ – no task-facing retry-policy API yet
capability: task-state-store MAY ✓ 3.3 Client.getTaskStateStore() get/set/delete/clear
capability: asset-state-store MAY ✗ – no task-facing state-store API yet
capability: asset-event-emit MAY ✗ – runtime does not emit asset events yet
capability: asset-event-read MAY ✗ – no task-facing asset-event API yet
Native-Dag authoring
capability: native-dag-authoring SHOULD ✓ 3.4
capability: task-args MUST † ✓ 3.4
capability: dag-params MUST † ✗ –
capability: taskflow-dependencies MUST † ✓ 3.4
capability: branching SHOULD † ✓ 3.4 DagDef.If / @Builder.If
capability: dag-test SHOULD † ✗ –
capability: task-group MAY † ✓ 3.4
capability: dynamic-task-mapping MAY † ✗ –
capability: asset-inlets-outlets MAY † ✗ –
capability: asset-scheduling MAY † ✗ –
capability: object-store MAY † ✗ –

Marks: ✓ supported · ✗ not supported · n/a not applicable. A tier marked † applies only when native-dag-authoring is supported.