kevdoran commented on code in PR #11079:
URL: https://github.com/apache/nifi/pull/11079#discussion_r3025786261


##########
nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/components/connector/StandardConnectorRepository.java:
##########
@@ -91,6 +107,288 @@ public void restoreConnector(final ConnectorNode 
connector) {
         logger.debug("Successfully restored {}", connector);
     }
 
+    @Override
+    public ConnectorSyncResult syncConnector(final VersionedConnector 
versionedConnector) {
+        final String connectorId = versionedConnector.getInstanceIdentifier();
+        final ScheduledState proposedScheduledState = 
versionedConnector.getScheduledState();
+        logger.debug("syncConnector called for connector [{}]", connectorId);
+
+        // Consult the provider for external state checks and working config
+        final ConnectorSyncDirective directive;
+        if (configurationProvider != null) {
+            try {
+                directive = configurationProvider.verifySyncable(connectorId, 
proposedScheduledState);
+            } catch (final Exception e) {
+                logger.error("Configuration provider threw exception during 
verifySyncable for connector [{}]: {}", connectorId, e.getMessage(), e);
+                final ConnectorNode existingNode = 
ensureConnectorNodeExists(versionedConnector);
+                existingNode.markInvalid("Flow Synchronization Failure",
+                        "Configuration provider error during synchronization: 
" + e.getMessage());
+                return ConnectorSyncResult.FAILED;
+            }
+        } else {
+            directive = ConnectorSyncDirective.allow();
+        }
+
+        logger.debug("Connector [{}] sync directive: {}", connectorId, 
directive);
+
+        // Handle REMOVE: connector should not exist on this node
+        if (directive.getAction() == ConnectorSyncDirective.Action.REMOVE) {
+            final ConnectorNode existingNode = connectors.remove(connectorId);

Review Comment:
   Ok added purge 



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