-
Notifications
You must be signed in to change notification settings - Fork 2.9k
NIFI-15355 Connector Configuration Repository #10876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NIFI-15355 Connector Configuration Repository #10876
Conversation
|
|
||
| // 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."; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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 :)
|
Thanks all. I've addressed the feedback and pushed updates to the PR |
bbende
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 Looks good
* NIFI-15255 Introduce ConnectorConfigurationRepository Extension Interface * Add new property key to default nifi.properties file * Address peer review comments
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 introducesConnectorConfigurationProvider, a framework extension point that allows Connector name and working flow configuration to be persisted in and loaded from an external store.Architecture
ConnectorConfigurationProvideris a nullable collaborator ofStandardConnectorRepository. 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()"| FLOWRead operations (
getConnector,getConnectors,addConnector,applyUpdate) callprovider.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, theConnectorNodeis 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
ConnectorConfigurationProviderExceptionrather than being silently swallowed, giving implementations control over failure semantics.New Types (
nifi-framework-api)ConnectorConfigurationProvider-- Extension point interface:initialize,load,save,discard,delete,verifyCreateConnectorConfigurationProviderInitializationContext-- ExposesMap<String, String>properties (following the established NiFi initialization context pattern)ConnectorWorkingConfiguration-- Mutable POJO carryingnameandList<VersionedConfigurationStep> workingFlowConfigurationConnectorConfigurationProviderException-- RuntimeException for provider failuresOther Changes
ConnectorNodemetadata updates -- All name modifications now go throughConnectorRepository.updateConnector()instead of callingconnectorNode.setName()directly. Updated call sites:StandardNiFiServiceFacade(via newConnectorDAO.updateConnector()),VersionedFlowSynchronizer.ConnectorRepository.verifyCreate()checks for duplicate IDs and delegates toprovider.verifyCreate().StandardConnectorDAO.verifyCreate()now delegates to the repository.addConnector()--StandardConnectorDAO.createConnector()no longer callsaddConnector()sinceFlowManager.createConnector()already does this.Configuration
Testing
25 unit tests in
TestStandardConnectorRepositorycovering read overrides, write-through atomicity, partial merge semantics, lifecycle delegation, exception propagation, cluster sync exclusion, andverifyCreate/addConnectoratomicity. UpdatedStandardConnectorDAOTestforverifyCreatedelegation.Files Changed
17 files, +975 / -30. Four new types in
nifi-framework-api, one new implementation innifi-framework-core, twelve modified files acrossnifi-framework-core,nifi-framework-core-api,nifi-web-api, andnifi-properties.