This is an automated email from the ASF dual-hosted git repository.

exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new d1daf215bea NIFI-15886 Include Controller Service bulletins at Process 
Group level (#11841)
d1daf215bea is described below

commit d1daf215beab366c079749dd58dfdab72d65a27b
Author: NissimShiman <[email protected]>
AuthorDate: Mon Nov 16 12:25:11 2026 -0500

    NIFI-15886 Include Controller Service bulletins at Process Group level 
(#11841)
    
    Signed-off-by: David Handermann <[email protected]>
---
 .../nifi/events/VolatileBulletinRepository.java    | 13 +++++++++--
 .../events/VolatileBulletinRepositoryTest.java     | 27 ++++++++++++++++++++++
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git 
a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/events/VolatileBulletinRepository.java
 
b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/events/VolatileBulletinRepository.java
index 3779f5b3445..489767c7aa1 100644
--- 
a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/events/VolatileBulletinRepository.java
+++ 
b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/events/VolatileBulletinRepository.java
@@ -285,7 +285,13 @@ public class VolatileBulletinRepository implements 
BulletinRepository {
     private String getBulletinStoreKey(final Bulletin bulletin) {
         return switch (bulletin.getSourceType()) {
             case FLOW_CONTROLLER -> CONTROLLER_BULLETIN_STORE_KEY;
-            case CONTROLLER_SERVICE -> SERVICE_BULLETIN_STORE_KEY;
+            case CONTROLLER_SERVICE -> {
+                if (bulletin.getGroupId() == null) {
+                    yield SERVICE_BULLETIN_STORE_KEY;
+                } else {
+                    yield bulletin.getGroupId();
+                }
+            }
             case REPORTING_TASK -> REPORTING_TASK_BULLETIN_STORE_KEY;
             case FLOW_ANALYSIS_RULE -> FLOW_ANALYSIS_RULE_BULLETIN_STORE_KEY;
             case PARAMETER_PROVIDER -> PARAMETER_PROVIDER_BULLETIN_STORE_KEY;
@@ -297,8 +303,11 @@ public class VolatileBulletinRepository implements 
BulletinRepository {
 
     private boolean isControllerBulletin(final Bulletin bulletin) {
         return switch (bulletin.getSourceType()) {
-            case FLOW_CONTROLLER, CONTROLLER_SERVICE, REPORTING_TASK, 
FLOW_ANALYSIS_RULE, PARAMETER_PROVIDER,
+            case FLOW_CONTROLLER, REPORTING_TASK, FLOW_ANALYSIS_RULE, 
PARAMETER_PROVIDER,
                  FLOW_REGISTRY_CLIENT -> true;
+            case CONTROLLER_SERVICE -> {
+                yield bulletin.getGroupId() == null;
+            }
             default -> false;
         };
     }
diff --git 
a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/events/VolatileBulletinRepositoryTest.java
 
b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/events/VolatileBulletinRepositoryTest.java
index 3925edccb61..71caf2234c3 100644
--- 
a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/events/VolatileBulletinRepositoryTest.java
+++ 
b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/events/VolatileBulletinRepositoryTest.java
@@ -17,6 +17,7 @@
 package org.apache.nifi.events;
 
 import org.apache.nifi.reporting.Bulletin;
+import org.apache.nifi.reporting.BulletinFactory;
 import org.apache.nifi.reporting.BulletinQuery;
 import org.apache.nifi.reporting.ComponentType;
 import org.junit.jupiter.api.BeforeEach;
@@ -30,6 +31,7 @@ import java.util.List;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class VolatileBulletinRepositoryTest {
 
@@ -184,6 +186,31 @@ public class VolatileBulletinRepositoryTest {
         assertEquals(clearedSingle, clearedMultiple);
     }
 
+    @Test
+    public void testControllerServiceBulletins() {
+        final String processGroupId = "processGroupId";
+
+        final Bulletin processGroupLevelBulletin = 
BulletinFactory.createBulletin(processGroupId, "processGroupName", 
"controllerServiceId1",
+                ComponentType.CONTROLLER_SERVICE, "controllerServiceName", 
"Controller Service", "INFO", "This is a process group level bulletin", 
"/groupPath");
+        repository.addBulletin(processGroupLevelBulletin);
+
+        final Bulletin controllerLevelBulletin = 
BulletinFactory.createBulletin(null, null, "controllerServiceId2",
+                ComponentType.CONTROLLER_SERVICE, "controllerServiceName", 
"Controller Service", "INFO", "This is a controller level bulletin", null);
+        repository.addBulletin(controllerLevelBulletin);
+
+        List<Bulletin> bulletins = 
repository.findBulletinsForGroupBySource(processGroupId);
+
+        assertEquals(1, bulletins.size());
+        assertEquals(processGroupLevelBulletin, bulletins.getFirst());
+
+        final BulletinQuery controllerServiceQuery = new 
BulletinQuery.Builder().sourceType(ComponentType.CONTROLLER_SERVICE).build();
+        bulletins = repository.findBulletins(controllerServiceQuery);
+
+        assertEquals(2, bulletins.size());
+        assertTrue(bulletins.contains(processGroupLevelBulletin));
+        assertTrue(bulletins.contains(controllerLevelBulletin));
+    }
+
     private void addBulletin(String sourceId, String message, Date timestamp) {
         TestBulletin bulletin = new TestBulletin(sourceId, message, timestamp);
         repository.addBulletin(bulletin);

Reply via email to