Skip to content

NIFI-16337: Add support for stopping Process Group sources - #11678

Merged
rfellows merged 2 commits into
apache:mainfrom
mcgilman:NIFI-16337
Sep 15, 2026
Merged

rfellows merged 2 commits into
apache:mainfrom
mcgilman:NIFI-16337

Conversation

@mcgilman

Copy link
Copy Markdown
Contributor

Summary

NIFI-16337

Adds a Stop sources operation for Standard Process Groups. This allows upstream source components to be stopped while downstream components remain running and continue processing queued FlowFiles.

Implementation

  • Adds PUT /flow/process-groups/{id}/sources.
  • Identifies active source processors, public input ports, and remote output ports recursively.
  • Excludes components belonging to Stateless Process Groups.
  • Rejects requests targeting a Process Group that resolves to the Stateless execution engine.
  • Exposes resolvedExecutionEngine on Process Group flow, DTO, and entity payloads.
  • Adds toolkit client support and Flow Designer state, effects, and context-menu integration.
  • Adds cluster response merging for component revisions returned by each node.

Design and Safety Decisions

Cluster consistency

The coordinator identifies the source components and replicates that fixed component set and its revisions to every node.

Each node independently recalculates its source set and requires exact set equality before scheduling. Set equality is order-independent, so map serialization order does not affect validation. If any node identifies a different set, phase-one validation rejects the request and no node performs the operation.

Authorization

The endpoint authorizes read access to /flow before execution-engine verification or source discovery. It then authorizes the scheduling operation for every requested source before validating the supplied source set.

This prevents unauthorized callers from using validation responses to inspect flow state and preserves all-or-nothing component authorization.

Stateless Process Groups

A Stateless target is rejected because its components cannot be scheduled individually through this operation. When a Standard parent contains Stateless descendants, those descendants are skipped and remain running.

Limited Process Group visibility

resolvedExecutionEngine is promoted to ProcessGroupEntity, allowing clients to determine whether the operation is supported even when the nested Process Group DTO is omitted because the user cannot read that Process Group.

Test Coverage

  • Source classification across processors, ports, remote ports, loops, nested groups, and component states.
  • Stateless target rejection and Stateless descendant exclusion.
  • Authorization ordering and all-or-nothing component authorization.
  • Exact source-set validation before replication and under the write lock.
  • Cluster response merging.
  • Flow Designer action, effect, state, and context-menu behavior.
  • Two-node system tests covering:
    • Successful source stopping with Stateless descendants left running.
    • Direct Stateless target rejection.
    • Client-supplied source-set mismatch rejection.
    • Cross-node source-state divergence with matching revisions, verifying phase-one rejection without mutation.

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000
  • Pull request contains commits signed with a registered key indicating Verified status

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Targeted Backend Tests

  • StandardNiFiServiceFacadeTest
  • TestFlowResource
  • StopSourcesEndpointMergerTest
  • DtoFactoryTest
  • EntityFactoryTest

Clustered System Tests

./mvnw -pl nifi-system-tests/nifi-system-test-suite \
  verify -P integration-tests -Dit.test=ClusteredStopSourcesIT

Result: 4 tests passed.

Frontend

  • npx nx test nifi — 329 test files and 2,831 tests passed
  • npx nx lint nifi

Static Analysis

  • Checkstyle and PMD passed for the modified Maven modules.
  • Toolkit client tests passed.
  • Runtime packaging artifacts were rebuilt before running system tests.

Build

  • Build completed using ./mvnw clean install -P contrib-check
    • JDK 21
    • JDK 25

Licensing

No new dependencies were introduced.

  • New dependencies are compatible with the Apache License 2.0 according to the License Policy
  • New dependencies are documented in applicable LICENSE and NOTICE files

Documentation

No rendered documentation changes.

  • Documentation formatting appears as expected in rendered files

- add the Stop sources REST endpoint and cluster response handling
- expose resolved execution engines on Process Group payloads
- add Flow Designer actions for stopping source components
- reject STATELESS targets and skip nested STATELESS groups
- add backend and frontend test coverage

@markap14 markap14 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @mcgilman changes make sense to me. I think this is a welcomed minor new feature, and all the changes on the backend look good to me. +1
I don't really have the ability to adequately review the UI code but if one of our more experienced UI folks in the community (@rfellows maybe?) wants to do a quick review of that I'd be supportive of merging.

@rfellows rfellows left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looked at the Flow Designer bits. The wiring follows the existing start/stop Process Group pattern, resolvedExecutionEngine is the right contract for limited PG visibility, and the menu/effect tests cover the STANDARD vs STATELESS cases well.

Two small nits inline. Context-menu-only (vs the Operation palette) is as-designed from my perspective.

return resolved === 'STANDARD';
},
clazz: 'fa fa-stop-circle-o',
text: 'Stop sources',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sibling items are Title Case (Stop, Empty All Queues, Disable All Controller Services). Would you mind using Stop Sources here so it matches? The new context-menu spec currently asserts the lowercase s, so those strings would need to move with it.

this.actions$.pipe(
ofType(FlowActions.stopSources),
map((action) => action.request),
switchMap((request) =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

stopComponent$ uses mergeMap for this same kind of scheduling request. switchMap here will unsubscribe and cancel the in-flight HTTP call if stopSources is dispatched again (double-click, or stopping a child group while a current-group request is still outstanding), while the coordinator may still apply the first request.

concatMap would serialize them; mergeMap would match the stop-component effect. Either is safer than cancelling.

@rfellows rfellows left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the contribution @mcgilman 👍

@rfellows
rfellows merged commit 751efb0 into apache:main Sep 15, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants