uranusjr commented on code in PR #65956:
URL: https://github.com/apache/airflow/pull/65956#discussion_r3283980746


##########
java-sdk/adr/0001-java-sdk-airflow-integration.md:
##########
@@ -0,0 +1,343 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+
+# ADR-0001: Java SDK Airflow Integration
+
+## Status
+
+Accepted
+
+## Context
+
+Airflow's current execution model is Python-only: DAGs are Python files, tasks 
are Python callables, and the task runner forks a Python process. To support 
DAGs and tasks authored in other languages (starting with Java), we need an 
architecture that:
+
+- Allows entire DAGs to be written in a non-Python language (pure Java DAG).
+- Allows non-Python tasks to coexist with Python tasks in the same DAG 
(`@task.stub`).
+- Reuses the existing task-runner two-layer design (task-runner process + 
forked child process) so Airflow extensions (XCom backends, connections, 
variables) stay in Python.
+- Is extensible to other languages (Go, Rust, etc.) without per-language 
changes to Airflow Core.
+
+The existing task runner already uses a two-layer design. When an executor 
wants to run a task, it starts a task-runner process that talks to Airflow Core 
through the Execution API, and forks another process that talks to the 
task-runner through TCP to run the actual task code. All the Airflow extensions 
simply go into the task-runner process, keeping them in Python.
+
+The only thing missing is a way for the task-runner process to run tasks in 
another language.
+
+## Decision
+
+### Writing a Non-Python Task
+
+There is one way to write a non-Python task: implement the language SDK's task 
interface. For Java, this is the `Task` interface with a single `execute(Client 
client)` method. The `Client` provides access to Airflow services (connections, 
variables, XCom).
+
+### Two Ways to Integrate Non-Python Tasks into a DAG
+
+We provide two approaches for integrating non-Python tasks into a DAG:
+
+**a) Pure Java DAG** — define the entire DAG in Java, with no Python file at 
all.
+The Java SDK provides `DagBundle`, `Dag`, and `Task` interfaces:
+
+```java
+public class JavaExample implements DagBundle {
+
+  public static class Extract implements Task {
+    public void execute(Client client) throws Exception {

Review Comment:
   ADR updated to explain the situation



-- 
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]

Reply via email to