You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by oe...@apache.org on 2026/04/09 11:15:15 UTC

(streampipes) branch 3042-automatic-handling-of-data-stream-changes-in-python-client updated: Create management for data stream update

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

oehler pushed a commit to branch 3042-automatic-handling-of-data-stream-changes-in-python-client
in repository https://gitbox.apache.org/repos/asf/streampipes.git


The following commit(s) were added to refs/heads/3042-automatic-handling-of-data-stream-changes-in-python-client by this push:
     new 643f5f2555 Create management for data stream update
643f5f2555 is described below

commit 643f5f2555689f7c238e08f8c029fd5714c40b7c
Author: Sven Oehler <oe...@web.de>
AuthorDate: Thu Apr 9 13:14:59 2026 +0200

    Create management for data stream update
---
 .../management/AdapterUpdateManagement.java        | 175 +++++---------------
 .../update/DataStreamUpdateManagement.java         |  76 +++++++++
 .../pipeline/update/PipelineUpdateCoordinator.java | 177 +++++++++++++++++++++
 .../pipeline/update/PipelineUpdateStrategy.java    |  30 ++++
 .../rest/impl/pe/DataStreamResource.java           |  22 ++-
 5 files changed, 340 insertions(+), 140 deletions(-)

diff --git a/streampipes-connect-management/src/main/java/org/apache/streampipes/connect/management/management/AdapterUpdateManagement.java b/streampipes-connect-management/src/main/java/org/apache/streampipes/connect/management/management/AdapterUpdateManagement.java
index 8e38497457..22a29076ad 100644
--- a/streampipes-connect-management/src/main/java/org/apache/streampipes/connect/management/management/AdapterUpdateManagement.java
+++ b/streampipes-connect-management/src/main/java/org/apache/streampipes/connect/management/management/AdapterUpdateManagement.java
@@ -19,49 +19,63 @@
 package org.apache.streampipes.connect.management.management;
 
 import org.apache.streampipes.commons.exceptions.connect.AdapterException;
-import org.apache.streampipes.commons.prometheus.pipelines.PipelinesStats;
 import org.apache.streampipes.manager.api.extensions.ExtensionServiceRequestManager;
-import org.apache.streampipes.manager.execution.PipelineExecutor;
-import org.apache.streampipes.manager.matching.PipelineVerificationHandlerV2;
-import org.apache.streampipes.manager.pipeline.PipelineManager;
+import org.apache.streampipes.manager.pipeline.update.PipelineUpdateCoordinator;
+import org.apache.streampipes.manager.pipeline.update.PipelineUpdateStrategy;
 import org.apache.streampipes.model.SpDataStream;
-import org.apache.streampipes.model.base.NamedStreamPipesEntity;
 import org.apache.streampipes.model.connect.adapter.AdapterDescription;
 import org.apache.streampipes.model.connect.adapter.PipelineUpdateInfo;
-import org.apache.streampipes.model.message.PipelineModificationMessage;
 import org.apache.streampipes.model.pipeline.Pipeline;
-import org.apache.streampipes.model.pipeline.PipelineElementValidationInfo;
-import org.apache.streampipes.model.pipeline.PipelineHealthStatus;
 import org.apache.streampipes.resource.management.AdapterResourceManager;
 import org.apache.streampipes.resource.management.DataStreamResourceManager;
 import org.apache.streampipes.resource.management.SpResourceManager;
-import org.apache.streampipes.storage.management.StorageDispatcher;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
-import java.util.stream.Stream;
 
 public class AdapterUpdateManagement {
 
-  private static final Logger LOG = LoggerFactory.getLogger(AdapterUpdateManagement.class);
+  private static final PipelineUpdateStrategy<AdapterDescription> PIPELINE_UPDATE_STRATEGY =
+      new PipelineUpdateStrategy<>() {
+        @Override
+        public String affectedElementId(AdapterDescription updateElement) {
+          return updateElement.getCorrespondingDataStreamElementId();
+        }
+
+        @Override
+        public Pipeline apply(Pipeline pipeline,
+                              AdapterDescription updateElement) {
+          var updatedStreams = pipeline
+              .getStreams()
+              .stream()
+              .peek(stream -> {
+                if (stream.getElementId().equals(updateElement.getCorrespondingDataStreamElementId())) {
+                  stream.setEventSchema(updateElement.getEventSchema());
+                  stream.setName(updateElement.getName());
+                }
+              })
+              .toList();
+
+          pipeline.setStreams(updatedStreams);
+          return pipeline;
+        }
+
+        @Override
+        public String notificationType() {
+          return "Adapter";
+        }
+      };
 
   private final AdapterMasterManagement adapterMasterManagement;
   private final AdapterResourceManager adapterResourceManager;
   private final DataStreamResourceManager dataStreamResourceManager;
-  private final ExtensionServiceRequestManager requestManager;
-  private static final PipelinesStats pipelinesStats = new PipelinesStats();
+  private final PipelineUpdateCoordinator pipelineUpdateCoordinator;
 
   public AdapterUpdateManagement(AdapterMasterManagement adapterMasterManagement,
                                  ExtensionServiceRequestManager requestManager) {
     this.adapterMasterManagement = adapterMasterManagement;
     this.adapterResourceManager = new SpResourceManager().manageAdapters();
     this.dataStreamResourceManager = new SpResourceManager().manageDataStreams();
-    this.requestManager = requestManager;
+    this.pipelineUpdateCoordinator = new PipelineUpdateCoordinator(requestManager);
   }
 
   public void updateAdapter(AdapterDescription ad)
@@ -77,36 +91,7 @@ public class AdapterUpdateManagement {
     // update data source in database
     this.updateDataSource(ad);
 
-    // update pipelines
-    var affectedPipelines = PipelineManager.getPipelinesContainingElements(ad.getCorrespondingDataStreamElementId());
-
-    affectedPipelines.forEach(p -> {
-      var shouldRestartPipeline = p.isRunning();
-      if (shouldRestartPipeline) {
-        new PipelineExecutor(p, requestManager).stopPipeline(true);
-      }
-      var storedPipeline = PipelineManager.getPipeline(p.getPipelineId());
-      var pipeline = applyUpdatedDataStream(storedPipeline, ad);
-      try {
-        var modificationMessage = new PipelineVerificationHandlerV2(pipeline, requestManager).verifyPipeline();
-        var updateInfo = makeUpdateInfo(modificationMessage, pipeline);
-        var modifiedPipeline = new PipelineVerificationHandlerV2(pipeline, requestManager)
-            .makeModifiedPipeline().pipeline();
-        var canAutoMigrate = canAutoMigrate(modificationMessage);
-        if (!canAutoMigrate) {
-          modifiedPipeline.setHealthStatus(PipelineHealthStatus.REQUIRES_ATTENTION);
-          pipelinesStats.updatePipelineHealthState(modifiedPipeline.getElementId(), modifiedPipeline.getName(),modifiedPipeline.getHealthStatus().toString());
-          modifiedPipeline.setPipelineNotifications(toNotification(updateInfo));
-          modifiedPipeline.setValid(false);
-        }
-        StorageDispatcher.INSTANCE.getNoSqlStore().getPipelineStorageAPI().updateElement(modifiedPipeline);
-        if (shouldRestartPipeline && canAutoMigrate) {
-          new PipelineExecutor(PipelineManager.getPipeline(p.getPipelineId()), requestManager).startPipeline();
-        }
-      } catch (Exception e) {
-        LOG.error("Could not update pipeline {}", pipeline.getName(), e);
-      }
-    });
+    pipelineUpdateCoordinator.updatePipelines(ad, PIPELINE_UPDATE_STRATEGY);
 
     if (shouldRestart) {
       this.adapterMasterManagement.startStreamAdapter(ad.getElementId());
@@ -114,95 +99,7 @@ public class AdapterUpdateManagement {
   }
 
   public List<PipelineUpdateInfo> checkPipelineMigrations(AdapterDescription adapterDescription) {
-    var affectedPipelines = PipelineManager
-        .getPipelinesContainingElements(adapterDescription.getCorrespondingDataStreamElementId());
-    var updateInfos = new ArrayList<PipelineUpdateInfo>();
-
-    affectedPipelines.forEach(pipeline -> {
-      var updatedPipeline = applyUpdatedDataStream(pipeline, adapterDescription);
-      try {
-        var modificationMessage = new PipelineVerificationHandlerV2(updatedPipeline, requestManager).verifyPipeline();
-        var updateInfo = makeUpdateInfo(modificationMessage, updatedPipeline);
-        updateInfos.add(updateInfo);
-      } catch (Exception e) {
-        throw new RuntimeException(e);
-      }
-    });
-
-    return updateInfos;
-  }
-
-  private PipelineUpdateInfo makeUpdateInfo(PipelineModificationMessage modificationMessage,
-                                            Pipeline pipeline) {
-    var updateInfo = new PipelineUpdateInfo();
-    updateInfo.setPipelineId(pipeline.getPipelineId());
-    updateInfo.setPipelineName(pipeline.getName());
-    updateInfo.setCanAutoMigrate(canAutoMigrate(modificationMessage));
-    updateInfo.setValidationInfos(extractModificationWarnings(pipeline, modificationMessage));
-    return updateInfo;
-  }
-
-  private boolean canAutoMigrate(PipelineModificationMessage modificationMessage) {
-    return modificationMessage
-        .getPipelineModifications()
-        .stream()
-        .allMatch(m -> m.isPipelineElementValid() && m.getValidationInfos().isEmpty());
-  }
-
-  private List<String> toNotification(PipelineUpdateInfo updateInfo) {
-    var notifications = new ArrayList<String>();
-    updateInfo.getValidationInfos().keySet().forEach((k) -> {
-      var msg =  updateInfo
-          .getValidationInfos()
-          .get(k)
-          .stream()
-          .map(PipelineElementValidationInfo::getMessage)
-          .toList()
-          .toString();
-      notifications.add(String.format("Adapter modification: %s: %s", k, msg));
-    });
-    return notifications;
-  }
-
-  private Map<String, List<PipelineElementValidationInfo>> extractModificationWarnings(
-      Pipeline pipeline,
-      PipelineModificationMessage modificationMessage) {
-    var infos = new HashMap<String, List<PipelineElementValidationInfo>>();
-    modificationMessage
-        .getPipelineModifications()
-        .stream()
-        .filter(v -> !v.getValidationInfos().isEmpty())
-        .forEach(m -> infos.put(getPipelineElementName(pipeline, m.getElementId()), m.getValidationInfos()));
-
-    return infos;
-  }
-
-  private String getPipelineElementName(Pipeline pipeline,
-                                        String elementId) {
-    return Stream
-        .concat(pipeline.getSepas().stream(), pipeline.getActions().stream())
-        .filter(p -> p.getElementId().equals(elementId))
-        .findFirst()
-        .map(NamedStreamPipesEntity::getName)
-        .orElse(elementId);
-  }
-
-  private Pipeline applyUpdatedDataStream(Pipeline originalPipeline,
-                                          AdapterDescription updatedAdapter) {
-    var updatedStreams = originalPipeline
-        .getStreams()
-        .stream()
-        .peek(s -> {
-          if (s.getElementId().equals(updatedAdapter.getCorrespondingDataStreamElementId())) {
-            s.setEventSchema(updatedAdapter.getEventSchema());
-            s.setName(updatedAdapter.getName());
-          }
-        })
-        .toList();
-
-    originalPipeline.setStreams(updatedStreams);
-
-    return originalPipeline;
+    return pipelineUpdateCoordinator.checkPipelineMigrations(adapterDescription, PIPELINE_UPDATE_STRATEGY);
   }
 
   private void updateDataSource(AdapterDescription ad) {
diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/update/DataStreamUpdateManagement.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/update/DataStreamUpdateManagement.java
new file mode 100644
index 0000000000..2c18bc628c
--- /dev/null
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/update/DataStreamUpdateManagement.java
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.streampipes.manager.pipeline.update;
+
+import org.apache.streampipes.manager.api.extensions.ExtensionServiceRequestManager;
+import org.apache.streampipes.model.SpDataStream;
+import org.apache.streampipes.model.connect.adapter.PipelineUpdateInfo;
+import org.apache.streampipes.model.pipeline.Pipeline;
+import org.apache.streampipes.resource.management.DataStreamResourceManager;
+import org.apache.streampipes.resource.management.SpResourceManager;
+
+import java.util.List;
+
+public class DataStreamUpdateManagement {
+
+  private static final PipelineUpdateStrategy<SpDataStream> PIPELINE_UPDATE_STRATEGY =
+      new PipelineUpdateStrategy<>() {
+        @Override
+        public String affectedElementId(SpDataStream updateElement) {
+          return updateElement.getElementId();
+        }
+
+        @Override
+        public Pipeline apply(Pipeline pipeline,
+                              SpDataStream updateElement) {
+          var updatedStreams = pipeline
+              .getStreams()
+              .stream()
+              .map(stream -> stream.getElementId().equals(updateElement.getElementId())
+                  ? new SpDataStream(updateElement)
+                  : stream)
+              .toList();
+
+          pipeline.setStreams(updatedStreams);
+          return pipeline;
+        }
+
+        @Override
+        public String notificationType() {
+          return "Data stream";
+        }
+      };
+
+  private final DataStreamResourceManager dataStreamResourceManager;
+  private final PipelineUpdateCoordinator pipelineUpdateCoordinator;
+
+  public DataStreamUpdateManagement(ExtensionServiceRequestManager requestManager) {
+    this.dataStreamResourceManager = new SpResourceManager().manageDataStreams();
+    this.pipelineUpdateCoordinator = new PipelineUpdateCoordinator(requestManager);
+  }
+
+  public void updateDataStream(SpDataStream dataStream) {
+    dataStreamResourceManager.update(dataStream);
+    pipelineUpdateCoordinator.updatePipelines(dataStream, PIPELINE_UPDATE_STRATEGY);
+  }
+
+  public List<PipelineUpdateInfo> checkPipelineMigrations(SpDataStream dataStream) {
+    return pipelineUpdateCoordinator.checkPipelineMigrations(dataStream, PIPELINE_UPDATE_STRATEGY);
+  }
+}
diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/update/PipelineUpdateCoordinator.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/update/PipelineUpdateCoordinator.java
new file mode 100644
index 0000000000..ab03e90c5f
--- /dev/null
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/update/PipelineUpdateCoordinator.java
@@ -0,0 +1,177 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.streampipes.manager.pipeline.update;
+
+import org.apache.streampipes.commons.prometheus.pipelines.PipelinesStats;
+import org.apache.streampipes.manager.api.extensions.ExtensionServiceRequestManager;
+import org.apache.streampipes.manager.execution.PipelineExecutor;
+import org.apache.streampipes.manager.matching.PipelineVerificationHandlerV2;
+import org.apache.streampipes.manager.pipeline.PipelineManager;
+import org.apache.streampipes.model.base.NamedStreamPipesEntity;
+import org.apache.streampipes.model.connect.adapter.PipelineUpdateInfo;
+import org.apache.streampipes.model.message.PipelineModificationMessage;
+import org.apache.streampipes.model.pipeline.Pipeline;
+import org.apache.streampipes.model.pipeline.PipelineElementValidationInfo;
+import org.apache.streampipes.model.pipeline.PipelineHealthStatus;
+import org.apache.streampipes.storage.management.StorageDispatcher;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Stream;
+
+public class PipelineUpdateCoordinator {
+
+  private static final Logger LOG = LoggerFactory.getLogger(PipelineUpdateCoordinator.class);
+  private static final PipelinesStats PIPELINES_STATS = new PipelinesStats();
+
+  private final ExtensionServiceRequestManager requestManager;
+
+  public PipelineUpdateCoordinator(ExtensionServiceRequestManager requestManager) {
+    this.requestManager = requestManager;
+  }
+
+  public <T> void updatePipelines(
+      T updateElement,
+      PipelineUpdateStrategy<T> pipelineUpdateStrategy
+  ) {
+    var elementId = pipelineUpdateStrategy.affectedElementId(updateElement);
+    var affectedPipelines = PipelineManager.getPipelinesContainingElements(elementId);
+
+    affectedPipelines.forEach(pipeline -> {
+      var shouldRestartPipeline = pipeline.isRunning();
+      if (shouldRestartPipeline) {
+        new PipelineExecutor(pipeline, requestManager).stopPipeline(true);
+      }
+
+      var storedPipeline = PipelineManager.getPipeline(pipeline.getPipelineId());
+      var updatedPipeline = pipelineUpdateStrategy.apply(storedPipeline, updateElement);
+
+      try {
+        var verificationHandler = new PipelineVerificationHandlerV2(updatedPipeline, requestManager);
+        var modificationMessage = verificationHandler.verifyPipeline();
+        var updateInfo = makeUpdateInfo(modificationMessage, updatedPipeline);
+        var modifiedPipeline = verificationHandler.makeModifiedPipeline().pipeline();
+        var canAutoMigrate = canAutoMigrate(modificationMessage);
+
+        if (!canAutoMigrate) {
+          modifiedPipeline.setHealthStatus(PipelineHealthStatus.REQUIRES_ATTENTION);
+          PIPELINES_STATS.updatePipelineHealthState(
+              modifiedPipeline.getElementId(),
+              modifiedPipeline.getName(),
+              modifiedPipeline.getHealthStatus().toString()
+          );
+          modifiedPipeline.setPipelineNotifications(toNotification(updateInfo, pipelineUpdateStrategy.notificationType()));
+          modifiedPipeline.setValid(false);
+        }
+
+        StorageDispatcher.INSTANCE.getNoSqlStore().getPipelineStorageAPI().updateElement(modifiedPipeline);
+
+        if (shouldRestartPipeline && canAutoMigrate) {
+          new PipelineExecutor(PipelineManager.getPipeline(pipeline.getPipelineId()), requestManager).startPipeline();
+        }
+      } catch (Exception e) {
+        LOG.error("Could not update pipeline {}", updatedPipeline.getName(), e);
+      }
+    });
+  }
+
+  public <T> List<PipelineUpdateInfo> checkPipelineMigrations(
+      T updateElement,
+      PipelineUpdateStrategy<T> pipelineUpdateStrategy
+  ) {
+    var elementId = pipelineUpdateStrategy.affectedElementId(updateElement);
+    var affectedPipelines = PipelineManager.getPipelinesContainingElements(elementId);
+    var updateInfos = new ArrayList<PipelineUpdateInfo>();
+
+    affectedPipelines.forEach(pipeline -> {
+      var updatedPipeline = pipelineUpdateStrategy.apply(pipeline, updateElement);
+      try {
+        var modificationMessage = new PipelineVerificationHandlerV2(updatedPipeline, requestManager).verifyPipeline();
+        updateInfos.add(makeUpdateInfo(modificationMessage, updatedPipeline));
+      } catch (Exception e) {
+        throw new RuntimeException(e);
+      }
+    });
+
+    return updateInfos;
+  }
+
+  private PipelineUpdateInfo makeUpdateInfo(PipelineModificationMessage modificationMessage,
+                                            Pipeline pipeline) {
+    var updateInfo = new PipelineUpdateInfo();
+    updateInfo.setPipelineId(pipeline.getPipelineId());
+    updateInfo.setPipelineName(pipeline.getName());
+    updateInfo.setCanAutoMigrate(canAutoMigrate(modificationMessage));
+    updateInfo.setValidationInfos(extractModificationWarnings(pipeline, modificationMessage));
+    return updateInfo;
+  }
+
+  private boolean canAutoMigrate(PipelineModificationMessage modificationMessage) {
+    return modificationMessage
+        .getPipelineModifications()
+        .stream()
+        .allMatch(modification -> modification.isPipelineElementValid()
+            && modification.getValidationInfos().isEmpty());
+  }
+
+  private List<String> toNotification(PipelineUpdateInfo updateInfo,
+                                      String updateType) {
+    var notifications = new ArrayList<String>();
+    updateInfo.getValidationInfos().forEach((pipelineElementName, validationInfos) -> {
+      var message = validationInfos
+          .stream()
+          .map(PipelineElementValidationInfo::getMessage)
+          .toList()
+          .toString();
+      notifications.add(String.format("%s modification: %s: %s", updateType, pipelineElementName, message));
+    });
+    return notifications;
+  }
+
+  private Map<String, List<PipelineElementValidationInfo>> extractModificationWarnings(
+      Pipeline pipeline,
+      PipelineModificationMessage modificationMessage) {
+    var infos = new HashMap<String, List<PipelineElementValidationInfo>>();
+    modificationMessage
+        .getPipelineModifications()
+        .stream()
+        .filter(modification -> !modification.getValidationInfos().isEmpty())
+        .forEach(modification -> infos.put(
+            getPipelineElementName(pipeline, modification.getElementId()),
+            modification.getValidationInfos()
+        ));
+
+    return infos;
+  }
+
+  private String getPipelineElementName(Pipeline pipeline,
+                                        String elementId) {
+    return Stream
+        .concat(pipeline.getSepas().stream(), pipeline.getActions().stream())
+        .filter(pipelineElement -> pipelineElement.getElementId().equals(elementId))
+        .findFirst()
+        .map(NamedStreamPipesEntity::getName)
+        .orElse(elementId);
+  }
+}
diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/update/PipelineUpdateStrategy.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/update/PipelineUpdateStrategy.java
new file mode 100644
index 0000000000..0770bfe887
--- /dev/null
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/pipeline/update/PipelineUpdateStrategy.java
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.streampipes.manager.pipeline.update;
+
+import org.apache.streampipes.model.pipeline.Pipeline;
+
+public interface PipelineUpdateStrategy<T> {
+
+  String affectedElementId(T updateElement);
+
+  Pipeline apply(Pipeline pipeline, T updateElement);
+
+  String notificationType();
+}
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/pe/DataStreamResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/pe/DataStreamResource.java
index f087549c61..53ad620aff 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/pe/DataStreamResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/pe/DataStreamResource.java
@@ -18,7 +18,10 @@
 
 package org.apache.streampipes.rest.impl.pe;
 
+import org.apache.streampipes.manager.api.extensions.ExtensionServiceRequestManager;
+import org.apache.streampipes.manager.pipeline.update.DataStreamUpdateManagement;
 import org.apache.streampipes.model.SpDataStream;
+import org.apache.streampipes.model.connect.adapter.PipelineUpdateInfo;
 import org.apache.streampipes.model.message.Message;
 import org.apache.streampipes.model.message.NotificationType;
 import org.apache.streampipes.model.monitoring.SpLogMessage;
@@ -46,6 +49,12 @@ import java.util.List;
 @RequestMapping("/api/v2/streams")
 public class DataStreamResource extends AbstractAuthGuardedRestResource {
 
+  private final DataStreamUpdateManagement dataStreamUpdateManagement;
+
+  public DataStreamResource(ExtensionServiceRequestManager requestManager) {
+    this.dataStreamUpdateManagement = new DataStreamUpdateManagement(requestManager);
+  }
+
   @GetMapping(path = "/available", produces = MediaType.APPLICATION_JSON_VALUE)
   @PreAuthorize(AuthConstants.HAS_READ_PIPELINE_ELEMENT_PRIVILEGE)
   @PostFilter("hasPermission(filterObject.elementId, 'READ')")
@@ -85,11 +94,22 @@ public class DataStreamResource extends AbstractAuthGuardedRestResource {
       throw new HttpResponseException(400,
           "Element ID in path variable does not match element ID in request body");
     } else {
-      getDataStreamResourceManager().update(updatedElement);
+      dataStreamUpdateManagement.updateDataStream(updatedElement);
       return constructSuccessMessage(NotificationType.STORAGE_SUCCESS.uiNotification());
     }
   }
 
+  @PutMapping(
+      path = "/pipeline-migration-preflight",
+      produces = MediaType.APPLICATION_JSON_VALUE,
+      consumes = MediaType.APPLICATION_JSON_VALUE
+  )
+  @PreAuthorize(AuthConstants.HAS_WRITE_PIPELINE_ELEMENT_PRIVILEGE)
+  public ResponseEntity<List<PipelineUpdateInfo>> performPipelineMigrationPreflight(
+      @RequestBody SpDataStream updatedElement) {
+    return ok(dataStreamUpdateManagement.checkPipelineMigrations(updatedElement));
+  }
+
   @PostMapping(
       produces = MediaType.APPLICATION_JSON_VALUE,
       consumes = MediaType.APPLICATION_JSON_VALUE