You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "mcgilman (via GitHub)" <gi...@apache.org> on 2026/05/13 13:41:19 UTC
[PR] NIFI-15936: Fixing connector flow uri pattern in cluster response mer… [nifi]
mcgilman opened a new pull request, #11244:
URL: https://github.com/apache/nifi/pull/11244
…ging.
# Summary
[NIFI-15936](https://issues.apache.org/jira/browse/NIFI-15936)
`ConnectorFlowEndpointMerger.canHandle` was never returning `true` for the actual connector flow endpoint, so cluster responses for `GET /nifi-api/connectors/{id}/flow/process-groups/{pgId}` were not being merged through `FlowMerger.mergeProcessGroupFlowDto`. The result on a multi-node cluster: per-node bulletins/statuses on the connector's flow are not aggregated into the coordinator's response, so bulletins emitted on non-coordinator nodes are not visible on the connector canvas.
The endpoint URI declared by `ConnectorResource` is:
https://github.com/apache/nifi/blob/main/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectorResource.java#L1755
i.e. `/connectors/{connectorId}/flow/process-groups/{processGroupId}`. The merger's pattern `/nifi-api/connectors/[a-f0-9\-]{36}/flow` was missing the trailing `/process-groups/{pgId}` segment, which under `Matcher#matches()` (whole-string match) meant `canHandle` always returned `false`.
## Change
- Updated `CONNECTOR_FLOW_URI_PATTERN` in `ConnectorFlowEndpointMerger` to `/nifi-api/connectors/[a-f0-9\-]{36}/flow/process-groups/[a-f0-9\-]{36}`, mirroring the shape of `FlowMerger.FLOW_URI_PATTERN`.
- The `mergeResponses` body is unchanged; it already delegates to the package-private `FlowMerger.mergeProcessGroupFlowDto`, which was the intended reuse all along.
- Added `ConnectorFlowEndpointMergerTest` covering `canHandle` for:
- the real connector flow URI (with and without `?uiOnly=true`),
- non-`GET` methods on the same URI,
- the previously-broken `/connectors/{id}/flow` shape (regression guard),
- adjacent connector sub-paths (`/controller-services`, `/parameter-context`) that must keep being routed to their own mergers,
- the standard `/nifi-api/flow/process-groups/{pgId}` URI (must remain owned by `FlowMerger`),
- non-UUID connector and process group ids.
## Scope
- nifi-api: no changes.
- DTO/entity surface: no changes.
- Server-side flow / aggregation logic: no changes — `getProcessGroupBulletins` already walks `findAllProcessGroups()` for descendants on the connector flow path; the bug was strictly in cluster-mode response routing.
- Standalone (non-clustered) NiFi: no behavior change.
- Cluster-mode NiFi: connector flow responses now flow through `FlowMerger.mergeProcessGroupFlowDto`, so per-node bulletins/statuses on the connector's flow are merged into the coordinator's response.
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-15936: Fixing connector flow uri pattern in cluster response mer… [nifi]
Posted by "rfellows (via GitHub)" <gi...@apache.org>.
rfellows commented on PR #11244:
URL: https://github.com/apache/nifi/pull/11244#issuecomment-4452974134
reviewing...
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-15936: Fixing connector flow uri pattern in cluster response mer… [nifi]
Posted by "rfellows (via GitHub)" <gi...@apache.org>.
rfellows merged PR #11244:
URL: https://github.com/apache/nifi/pull/11244
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-15936: Fixing connector flow uri pattern in cluster response mer… [nifi]
Posted by "rfellows (via GitHub)" <gi...@apache.org>.
rfellows commented on code in PR #11244:
URL: https://github.com/apache/nifi/pull/11244#discussion_r3243341997
##########
nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/coordination/http/endpoints/ConnectorFlowEndpointMergerTest.java:
##########
Review Comment:
This uses 8 separate `@Test` methods, each with a single assertion. The established convention in this exact test folder (`AccessPolicyEndpointMergerTest`, `ClearBulletinsEndpointMergerTest`, `ClearBulletinsForGroupEndpointMergerTest`) and the project rule `.cursor/rules/testing-standards.mdc` ("create the prerequisite objects, invoke the method we care about with appropriate arguments, make assertions, and then invoke again with a different set of arguments, make assertions") both point toward a single consolidated `testCanHandle()` method with multiple assertions. Suggested rewrite:
```java
@Test
public void testCanHandle() {
final ConnectorFlowEndpointMerger merger = new ConnectorFlowEndpointMerger();
final String connectorId = "12345678-1234-1234-1234-123456789012";
final String processGroupId = "abcdef01-2345-6789-abcd-ef0123456789";
final String connectorFlowUri = "/nifi-api/connectors/" + connectorId + "/flow/process-groups/" + processGroupId;
assertTrue(merger.canHandle(URI.create(connectorFlowUri), "GET"));
assertTrue(merger.canHandle(URI.create(connectorFlowUri + "?uiOnly=true"), "GET"));
assertFalse(merger.canHandle(URI.create(connectorFlowUri), "POST"));
assertFalse(merger.canHandle(URI.create("/nifi-api/connectors/" + connectorId + "/flow"), "GET"));
assertFalse(merger.canHandle(URI.create(connectorFlowUri + "/controller-services"), "GET"));
assertFalse(merger.canHandle(URI.create("/nifi-api/flow/process-groups/" + processGroupId), "GET"));
assertFalse(merger.canHandle(URI.create("/nifi-api/connectors/not-a-uuid/flow/process-groups/" + processGroupId), "GET"));
assertFalse(merger.canHandle(URI.create("/nifi-api/connectors/" + connectorId + "/flow/process-groups/not-a-uuid"), "GET"));
}
```
##########
nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/coordination/http/endpoints/ConnectorFlowEndpointMergerTest.java:
##########
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.cluster.coordination.http.endpoints;
+
+import org.junit.jupiter.api.Test;
+
+import java.net.URI;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class ConnectorFlowEndpointMergerTest {
+
+ private static final String CONNECTOR_ID = "12345678-1234-1234-1234-123456789012";
+ private static final String PROCESS_GROUP_ID = "abcdef01-2345-6789-abcd-ef0123456789";
+
+ private final ConnectorFlowEndpointMerger merger = new ConnectorFlowEndpointMerger();
+
+ @Test
+ public void testCanHandleConnectorProcessGroupFlowUri() {
+ final URI uri = URI.create("/nifi-api/connectors/" + CONNECTOR_ID + "/flow/process-groups/" + PROCESS_GROUP_ID);
+ assertTrue(merger.canHandle(uri, "GET"));
+ }
+
+ @Test
+ public void testCanHandleIgnoresQueryParameters() {
+ final URI uri = URI.create("/nifi-api/connectors/" + CONNECTOR_ID + "/flow/process-groups/" + PROCESS_GROUP_ID + "?uiOnly=true");
+ assertTrue(merger.canHandle(uri, "GET"));
+ }
+
+ @Test
+ public void testCannotHandleNonGetMethods() {
+ final URI uri = URI.create("/nifi-api/connectors/" + CONNECTOR_ID + "/flow/process-groups/" + PROCESS_GROUP_ID);
+ assertFalse(merger.canHandle(uri, "POST"));
+ assertFalse(merger.canHandle(uri, "PUT"));
+ assertFalse(merger.canHandle(uri, "DELETE"));
Review Comment:
`testCannotHandleNonGetMethods` exercises the same `!"GET".equalsIgnoreCase(method)` branch three times (`POST`/`PUT`/`DELETE`). Project guidance is to avoid "multiple tests whose differences are conditions that do not truly affect the behavior of the code." One non-GET method is enough. (Falls out naturally if the consolidation above is applied.)
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org