Skip to content

Conversation

@kevdoran
Copy link
Contributor

@kevdoran kevdoran commented Feb 9, 2026

Summary

NIFI-15355

Motivation

Connector working configuration currently lives only in memory and is persisted to flow.json.gz. There is no way for an external system to manage or override it. This PR introduces ConnectorConfigurationProvider, a framework extension point that allows Connector name and working flow configuration to be persisted in and loaded from an external store.

Architecture

ConnectorConfigurationProvider is a nullable collaborator of StandardConnectorRepository. When absent (the default), all behavior is unchanged. When present, the repository calls it on every read and write:

graph TB
    subgraph "REST / Service / DAO Layers"
        CR["ConnectorResource"]
        SF["NiFiServiceFacade"]
        DAO["ConnectorDAO"]
    end

    subgraph "Controller Layer"
        FC["FlowController"]
        FM["FlowManager"]
    end

    subgraph "Repository Layer"
        REPO["ConnectorRepository (StandardConnectorRepository)"]
        ASSETREPO["ConnectorAssetRepository"]
        CCP["🆕 ConnectorConfigurationProvider (nullable, NAR-discovered)"]
    end

    subgraph "In-Memory"
        CN["ConnectorNode"]
        AFC["activeFlowContext"]
        WFC["workingFlowContext"]
    end

    subgraph "Persistence"
        FLOW["flow.json.gz"]
        EXT["🆕 External Store (database, etc.)"]
    end

    CR --> SF --> DAO --> REPO
    DAO --> FM --> CN
    REPO --> CN
    REPO --> ASSETREPO
    REPO -->|"load / save / discard / delete / verifyCreate"| CCP
    CCP --> EXT
    CN --> AFC
    CN --> WFC
    SF -.->|"saveFlow()"| FLOW
Loading

Read operations (getConnector, getConnectors, addConnector, applyUpdate) call provider.load() and override the in-memory name and working flow configuration with the provider's values.

Write operations (configureConnector, discardWorkingConfiguration, updateConnector) sync with the provider before modifying in-memory state. If the provider throws, the ConnectorNode is unchanged.

Cluster sync (inheritConfiguration) does not interact with the provider, as the design is that cluster operations such as a new node joining the cluster should always inherit the current, local connector state.

Provider failures propagate as ConnectorConfigurationProviderException rather than being silently swallowed, giving implementations control over failure semantics.

New Types (nifi-framework-api)

  • ConnectorConfigurationProvider -- Extension point interface: initialize, load, save, discard, delete, verifyCreate
  • ConnectorConfigurationProviderInitializationContext -- Exposes Map<String, String> properties (following the established NiFi initialization context pattern)
  • ConnectorWorkingConfiguration -- Mutable POJO carrying name and List<VersionedConfigurationStep> workingFlowConfiguration
  • ConnectorConfigurationProviderException -- RuntimeException for provider failures

Other Changes

  • Centralized ConnectorNode metadata updates -- All name modifications now go through ConnectorRepository.updateConnector() instead of calling connectorNode.setName() directly. Updated call sites: StandardNiFiServiceFacade (via new ConnectorDAO.updateConnector()), VersionedFlowSynchronizer.
  • Centralized create verification -- ConnectorRepository.verifyCreate() checks for duplicate IDs and delegates to provider.verifyCreate(). StandardConnectorDAO.verifyCreate() now delegates to the repository.
  • Removed redundant addConnector() -- StandardConnectorDAO.createConnector() no longer calls addConnector() since FlowManager.createConnector() already does this.

Configuration

nifi.components.connectors.configuration.provider.implementation=com.example.MyProvider
nifi.components.connectors.configuration.provider.db.url=jdbc:postgresql://localhost/nifi

Testing

25 unit tests in TestStandardConnectorRepository covering read overrides, write-through atomicity, partial merge semantics, lifecycle delegation, exception propagation, cluster sync exclusion, and verifyCreate / addConnector atomicity. Updated StandardConnectorDAOTest for verifyCreate delegation.

Files Changed

17 files, +975 / -30. Four new types in nifi-framework-api, one new implementation in nifi-framework-core, twelve modified files across nifi-framework-core, nifi-framework-core-api, nifi-web-api, and nifi-properties.

@kevdoran kevdoran added the NIP-11 NIP-11 adds support for Connectors label Feb 9, 2026

// Connector Configuration Provider properties
public static final String CONNECTOR_CONFIGURATION_PROVIDER_IMPLEMENTATION = "nifi.components.connectors.configuration.provider.implementation";
public static final String CONNECTOR_CONFIGURATION_PROVIDER_PROPERTIES_PREFIX = "nifi.components.connectors.configuration.provider.";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor - would consider updating the default nifi.properties to include these

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it. I left it blank by default (with a mvn/env override) because there is no standard implementation by default, it is a nullable/optional collaborator.

repository.addConnector(connector);

// Reset interactions so we can verify that inheritConfiguration itself does not call the provider
org.mockito.Mockito.reset(provider);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should avoid the fully-qualified class name :)

@kevdoran
Copy link
Contributor Author

kevdoran commented Feb 9, 2026

Thanks all. I've addressed the feedback and pushed updates to the PR

Copy link
Contributor

@bbende bbende left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 Looks good

@bbende bbende merged commit c949b0d into apache:NIFI-15258 Feb 10, 2026
1 of 11 checks passed
markap14 pushed a commit that referenced this pull request Feb 11, 2026
* NIFI-15255 Introduce ConnectorConfigurationRepository Extension Interface
* Add new property key to default nifi.properties file
* Address peer review comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NIP-11 NIP-11 adds support for Connectors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants