Matt Gilman created NIFI-16337:
----------------------------------

             Summary: Stop source components in a Process Group without 
stopping the rest of the group
                 Key: NIFI-16337
                 URL: https://issues.apache.org/jira/browse/NIFI-16337
             Project: Apache NiFi
          Issue Type: Improvement
          Components: Core Framework, Core UI
            Reporter: Matt Gilman
            Assignee: Matt Gilman


Users often want to stop new data from entering a Process Group while letting 
in-flight FlowFiles finish and still cross Process Group boundaries. Today, 
Start/Stop applies to the whole group (or the entire Remote Process Group), 
which also stops local ports and RPG egress.

Add a Process Group action that stops only sources of new data in that group 
and its descendants.
h3. What is stopped
 * Source processors: no incoming connections, or only self-loops 
(!Connectables.hasNonLoopConnection)
 * Remote Process Group output ports (REMOTE_OUTPUT_PORT): stop transmitting 
that port, not the whole RPG
 * Public input ports (PublicPort + INPUT_PORT) when they have no non-loop 
incoming connection (typical Site-to-Site ingress on the root group)

h3. What is left running
 * Ordinary local input/output ports (LocalPort)
 * Public output ports
 * RPG remote input ports (REMOTE_INPUT_PORT)
 * The Remote Process Group as a whole
 * Funnels and non-source processors

This is intentional: stopping a child's local input ports would block the 
parent from feeding it, and stopping output ports or RPG egress would trap data 
that should leave.
h3. API

PUT /nifi-api/flow/process-groups/\{id}/sources

Request body reuses ScheduleComponentsEntity:
{code:json}
{
  "id": "<process-group-id>",
  "state": "STOPPED",
  "disconnectedNodeAcknowledged": false
}
{code}
components is omitted by the client. The coordinator identifies sources, 
fail-closed authorizes operate on each one, fills components, then replicates. 
Replicas do not rediscover. If no sources are found, the response is 200 with 
an empty components map. If the user cannot operate any identified source, the 
request fails with 403 and nothing is stopped.

The identified IDs are stopped through the existing scheduleComponents(..., 
STOPPED, ...) path (PROCESSOR → stopProcessor, INPUT_PORT → stopInputPort, 
REMOTE_OUTPUT_PORT → stopTransmitting). Do not call the bulk RPG run-status 
endpoint, which would stop all transmission including egress.

Identification lives on NiFiServiceFacade.findSourceComponentIds(ProcessGroup). 
A cluster StopSourcesEndpointMerger is registered for the new URI.
h3. UI

Flow Designer context menu: Stop sources. Available on canvas background 
(current group) or a selected Process Group. No confirmation dialog (same as 
Start/Stop).
h3. How to test
 # Create a Process Group with a source processor, a downstream processor, a 
local input/output port pair, and (if possible) an RPG with both input and 
output ports and a public input port.
 # Start the group. Right-click the canvas or the Process Group and choose Stop 
sources.
 # Verify the source processor, RPG output port, and public input port stop; 
local ports, RPG input ports, and downstream processors remain running.
 # Confirm queued data can still leave the group through local output ports.
 # As a user without operate permission on one identified source, confirm the 
request fails with 403 and no component is stopped.
 # In a cluster, confirm the coordinator identifies sources once and replicas 
apply the filled components list.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to