This is an automated email from the ASF dual-hosted git repository.

markap14 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-api.git


The following commit(s) were added to refs/heads/main by this push:
     new 3799fb1  NIFI-16634: Allow Connector to provide PreUpgradeFlow (#116)
3799fb1 is described below

commit 3799fb192ddd9166f6ae6b619f3f1dc4c09e61a5
Author: Bob Paulin <[email protected]>
AuthorDate: Tue Dec 1 08:59:03 2026 -0600

    NIFI-16634: Allow Connector to provide PreUpgradeFlow (#116)
    
    * Use flow context to provide an flow that can be used when there is no
    persisted flow on the runtime pre NIP-49
---
 .../org/apache/nifi/components/connector/Connector.java     | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/main/java/org/apache/nifi/components/connector/Connector.java 
b/src/main/java/org/apache/nifi/components/connector/Connector.java
index 853db0d..6589305 100644
--- a/src/main/java/org/apache/nifi/components/connector/Connector.java
+++ b/src/main/java/org/apache/nifi/components/connector/Connector.java
@@ -26,6 +26,7 @@ import 
org.apache.nifi.migration.ConnectorPropertyConfiguration;
 
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.concurrent.CompletableFuture;
 
 /**
@@ -253,6 +254,18 @@ public interface Connector {
         return CompletableFuture.completedFuture(null);
     }
 
+    /**
+     * Returns the flow that a previous version of this Connector installed, 
for use as the pre-upgrade flow when that flow was
+     * not persisted. The flow must use the previous version's versioned 
component identifiers so that queued FlowFiles can be
+     * restored and drained before the current flow replaces it.
+     *
+     * @param preUpgradeFlowContext the Active flow context, with migrated 
configuration and the bundle that saved it
+     * @return the flow that the previous version installed, or an empty 
Optional if none is needed
+     */
+    default Optional<VersionedExternalFlow> getPreUpgradeFlow(final 
FlowContext preUpgradeFlowContext) {
+        return Optional.empty();
+    }
+
     /**
      * Drains any in-flight FlowFiles from the flow associated with the given 
Flow Context by processing the existing data
      * but not accepting any new data.

Reply via email to