martinzink commented on code in PR #1850:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1850#discussion_r1824314161


##########
libminifi/src/core/flow/StructuredConfiguration.cpp:
##########
@@ -1014,4 +1016,20 @@ std::string StructuredConfiguration::serialize(const 
core::ProcessGroup& process
   return flow_serializer_->serialize(process_group, schema_, 
sensitive_values_encryptor_, {});
 }
 
+void StructuredConfiguration::migrate(Node& root_node, const FlowSchema& 
schema) const {
+  const auto flow_migrator_classes = 
ClassLoader::getDefaultClassLoader().getAll(ResourceType::FlowMigrator);
+
+  for (auto& flow_migrator_class : flow_migrator_classes) {
+    if (const auto flow_migrator = 
ClassLoader::getDefaultClassLoader().instantiate<FlowMigrator>(flow_migrator_class,
 flow_migrator_class)) {
+      try {
+        flow_migrator->migrate(root_node, schema);
+      } catch (const std::exception& exception) {
+        logger_->log_error("Caught Exception during flow {}::migration, type: 
{}, what: {}", flow_migrator->getName(), typeid(exception).name(), 
exception.what());
+      }
+    } else {
+      logger_->log_error("ResourceType::FlowMigrator is not a 
core::flow::FlowMigrator");

Review Comment:
   Good idea, 
https://github.com/apache/nifi-minifi-cpp/pull/1850/commits/f7f0fe332f45d4c6e52ebd5ce842dc1c87536fac#diff-92a05a81d17c1ba3e8c569fcf3b4498cfd1eadf0244f82a82c639a891c3fa6fbR1030



-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to