You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/11/27 13:14:39 UTC

(camel) branch node-prefix-id created (now 7a4e08615f5)

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

davsclaus pushed a change to branch node-prefix-id
in repository https://gitbox.apache.org/repos/asf/camel.git


      at 7a4e08615f5 Regen

This branch includes the following new commits:

     new e789cef62ae CAMEL-20155: camel-core - Add nodePrefixId to mbean. Polish route dev console.
     new a0a49e102fa CAMEL-20155: camel-core - Add nodePrefixId to mbean.
     new 31a51d36a1f CAMEL-20155: camel-core - MBean should use nodePrefixId in their ObjectName (used for avoding duplicate ids and be able to assign fixed ids)
     new f02b7f7cf6b CAMEL-20155: camel-jbang - camel get processor should not show nodePrefixId as this is noisy
     new 7a4e08615f5 Regen

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(camel) 04/05: CAMEL-20155: camel-jbang - camel get processor should not show nodePrefixId as this is noisy

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch node-prefix-id
in repository https://gitbox.apache.org/repos/asf/camel.git

commit f02b7f7cf6b774b1069b1b913463e650cab5183a
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Nov 27 14:08:05 2023 +0100

    CAMEL-20155: camel-jbang - camel get processor should not show nodePrefixId as this is noisy
---
 .../java/org/apache/camel/impl/console/RouteDevConsole.java  |  4 ++++
 .../jbang/core/commands/process/CamelProcessorStatus.java    | 12 +++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/core/camel-console/src/main/java/org/apache/camel/impl/console/RouteDevConsole.java b/core/camel-console/src/main/java/org/apache/camel/impl/console/RouteDevConsole.java
index d1072f32285..69c3b25f22a 100644
--- a/core/camel-console/src/main/java/org/apache/camel/impl/console/RouteDevConsole.java
+++ b/core/camel-console/src/main/java/org/apache/camel/impl/console/RouteDevConsole.java
@@ -151,6 +151,9 @@ public class RouteDevConsole extends AbstractDevConsole {
         for (ManagedProcessorMBean mp : mps) {
             sb.append("\n");
             sb.append(String.format("\n        Id: %s", mp.getProcessorId()));
+            if (mp.getNodePrefixId() != null) {
+                sb.append(String.format("\n        Node Prefix Id: %s", mp.getNodePrefixId()));
+            }
             sb.append(String.format("\n        Processor: %s", mp.getProcessorName()));
             sb.append(String.format("\n        Level: %d", mp.getLevel()));
             if (mp.getSourceLocation() != null) {
@@ -283,6 +286,7 @@ public class RouteDevConsole extends AbstractDevConsole {
             arr.add(jo);
 
             jo.put("id", mp.getProcessorId());
+            jo.put("nodePrefixId", mp.getNodePrefixId());
             if (mp.getSourceLocation() != null) {
                 String loc = mp.getSourceLocation();
                 if (mp.getSourceLineNumber() != null) {
diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/CamelProcessorStatus.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/CamelProcessorStatus.java
index 473a9409075..ec9a34e71cf 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/CamelProcessorStatus.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/CamelProcessorStatus.java
@@ -98,6 +98,7 @@ public class CamelProcessorStatus extends ProcessWatchCommand {
                             }
                             row.pid = Long.toString(ph.pid());
                             row.routeId = o.getString("routeId");
+                            row.nodePrefixId = o.getString("nodePrefixId");
                             row.processor = o.getString("from");
                             row.source = o.getString("source");
                             row.state = o.getString("state");
@@ -170,6 +171,7 @@ public class CamelProcessorStatus extends ProcessWatchCommand {
             row.routeId = route.routeId;
             rows.add(row);
             row.processorId = o.getString("id");
+            row.nodePrefixId = o.getString("nodePrefixId");
             row.processor = o.getString("processor");
             row.level = o.getIntegerOrDefault("level", 0);
             row.source = o.getString("source");
@@ -285,7 +287,14 @@ public class CamelProcessorStatus extends ProcessWatchCommand {
         if (source && r.source != null) {
             answer = sourceLocLine(r.source);
         } else {
-            answer = r.processorId != null ? r.processorId : r.routeId;
+            if (r.processorId == null) {
+                answer = r.routeId;
+            } else {
+                answer = r.processorId;
+                if (r.nodePrefixId != null && answer.startsWith(r.nodePrefixId)) {
+                    answer = answer.substring(r.nodePrefixId.length());
+                }
+            }
         }
         return answer;
     }
@@ -316,6 +325,7 @@ public class CamelProcessorStatus extends ProcessWatchCommand {
         String name;
         long uptime;
         String routeId;
+        String nodePrefixId;
         String processorId;
         String processor;
         int level;


(camel) 01/05: CAMEL-20155: camel-core - Add nodePrefixId to mbean. Polish route dev console.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch node-prefix-id
in repository https://gitbox.apache.org/repos/asf/camel.git

commit e789cef62ae2aded44c434ae2003575a3f50e8ca
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Nov 27 12:30:48 2023 +0100

    CAMEL-20155: camel-core - Add nodePrefixId to mbean. Polish route dev console.
---
 core/camel-api/src/main/java/org/apache/camel/Route.java      |  6 ++++++
 .../main/java/org/apache/camel/impl/engine/DefaultRoute.java  |  5 +++++
 .../java/org/apache/camel/impl/console/RouteDevConsole.java   | 11 +++++++++--
 .../src/main/java/org/apache/camel/reifier/RouteReifier.java  |  5 ++++-
 .../apache/camel/api/management/mbean/ManagedRouteMBean.java  |  3 +++
 .../java/org/apache/camel/management/mbean/ManagedRoute.java  |  5 +++++
 6 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/core/camel-api/src/main/java/org/apache/camel/Route.java b/core/camel-api/src/main/java/org/apache/camel/Route.java
index 2491513ac7e..a7d0f0cd054 100644
--- a/core/camel-api/src/main/java/org/apache/camel/Route.java
+++ b/core/camel-api/src/main/java/org/apache/camel/Route.java
@@ -44,6 +44,7 @@ public interface Route extends RuntimeConfiguration {
     String CUSTOM_ID_PROPERTY = "customId";
     String PARENT_PROPERTY = "parent";
     String GROUP_PROPERTY = "group";
+    String NODE_PREFIX_ID_PROPERTY = "nodePrefixId";
     String REST_PROPERTY = "rest";
     String TEMPLATE_PROPERTY = "template";
     String DESCRIPTION_PROPERTY = "description";
@@ -57,6 +58,11 @@ public interface Route extends RuntimeConfiguration {
      */
     String getId();
 
+    /**
+     * Gets the node prefix id
+     */
+    String getNodePrefixId();
+
     /**
      * Whether the route id is custom assigned or auto assigned
      *
diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultRoute.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultRoute.java
index 216577726d4..d8ace10e795 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultRoute.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultRoute.java
@@ -130,6 +130,11 @@ public class DefaultRoute extends ServiceSupport implements Route {
         return routeId;
     }
 
+    @Override
+    public String getNodePrefixId() {
+        return (String) properties.get(Route.NODE_PREFIX_ID_PROPERTY);
+    }
+
     @Override
     public boolean isCustomId() {
         return "true".equals(properties.get(Route.CUSTOM_ID_PROPERTY));
diff --git a/core/camel-console/src/main/java/org/apache/camel/impl/console/RouteDevConsole.java b/core/camel-console/src/main/java/org/apache/camel/impl/console/RouteDevConsole.java
index 31f2607b583..d1072f32285 100644
--- a/core/camel-console/src/main/java/org/apache/camel/impl/console/RouteDevConsole.java
+++ b/core/camel-console/src/main/java/org/apache/camel/impl/console/RouteDevConsole.java
@@ -69,6 +69,9 @@ public class RouteDevConsole extends AbstractDevConsole {
                 sb.append("\n");
             }
             sb.append(String.format("    Id: %s", mrb.getRouteId()));
+            if (mrb.getNodePrefixId() != null) {
+                sb.append(String.format("    Node Prefix Id: %s", mrb.getNodePrefixId()));
+            }
             sb.append(String.format("\n    From: %s", mrb.getEndpointUri()));
             if (mrb.getSourceLocation() != null) {
                 sb.append(String.format("\n    Source: %s", mrb.getSourceLocation()));
@@ -164,8 +167,9 @@ public class RouteDevConsole extends AbstractDevConsole {
             sb.append(String.format("\n        Max Time: %s", TimeUtils.printDuration(mp.getMaxProcessingTime(), true)));
             sb.append(String.format("\n        Min Time: %s", TimeUtils.printDuration(mp.getMinProcessingTime(), true)));
             if (mp.getExchangesTotal() > 0) {
-                sb.append(String.format("\n    Last Time: %s", TimeUtils.printDuration(mp.getLastProcessingTime(), true)));
-                sb.append(String.format("\n    Delta Time: %s", TimeUtils.printDuration(mp.getDeltaProcessingTime(), true)));
+                sb.append(String.format("\n        Last Time: %s", TimeUtils.printDuration(mp.getLastProcessingTime(), true)));
+                sb.append(
+                        String.format("\n        Delta Time: %s", TimeUtils.printDuration(mp.getDeltaProcessingTime(), true)));
             }
             Date last = mp.getLastExchangeCompletedTimestamp();
             if (last != null) {
@@ -189,6 +193,9 @@ public class RouteDevConsole extends AbstractDevConsole {
             JsonObject jo = new JsonObject();
             list.add(jo);
             jo.put("routeId", mrb.getRouteId());
+            if (mrb.getNodePrefixId() != null) {
+                jo.put("nodePrefixId", mrb.getNodePrefixId());
+            }
             jo.put("from", mrb.getEndpointUri());
             if (mrb.getSourceLocation() != null) {
                 jo.put("source", mrb.getSourceLocation());
diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/RouteReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/RouteReifier.java
index cea8c7e5df2..ae12fef7187 100644
--- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/RouteReifier.java
+++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/RouteReifier.java
@@ -59,7 +59,7 @@ public class RouteReifier extends ProcessorReifier<RouteDefinition> {
 
     private static final String[] RESERVED_PROPERTIES = new String[] {
             Route.ID_PROPERTY, Route.CUSTOM_ID_PROPERTY, Route.PARENT_PROPERTY,
-            Route.DESCRIPTION_PROPERTY, Route.GROUP_PROPERTY,
+            Route.DESCRIPTION_PROPERTY, Route.GROUP_PROPERTY, Route.NODE_PREFIX_ID_PROPERTY,
             Route.REST_PROPERTY, Route.CONFIGURATION_ID_PROPERTY };
 
     public RouteReifier(CamelContext camelContext, ProcessorDefinition<?> definition) {
@@ -372,6 +372,9 @@ public class RouteReifier extends ProcessorReifier<RouteDefinition> {
         if (definition.getGroup() != null) {
             routeProperties.put(Route.GROUP_PROPERTY, definition.getGroup());
         }
+        if (definition.getNodePrefixId() != null) {
+            routeProperties.put(Route.NODE_PREFIX_ID_PROPERTY, definition.getNodePrefixId());
+        }
         String rest = Boolean.toString(definition.isRest() != null && definition.isRest());
         routeProperties.put(Route.REST_PROPERTY, rest);
         String template = Boolean.toString(definition.isTemplate() != null && definition.isTemplate());
diff --git a/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedRouteMBean.java b/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedRouteMBean.java
index 1ea2d61ca74..9687add7998 100644
--- a/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedRouteMBean.java
+++ b/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedRouteMBean.java
@@ -28,6 +28,9 @@ public interface ManagedRouteMBean extends ManagedPerformanceCounterMBean {
     @ManagedAttribute(description = "Route ID")
     String getRouteId();
 
+    @ManagedAttribute(description = "Node Prefix ID")
+    String getNodePrefixId();
+
     @ManagedAttribute(description = "Route Group")
     String getRouteGroup();
 
diff --git a/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedRoute.java b/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedRoute.java
index 301739c0df4..d3c559e5198 100644
--- a/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedRoute.java
+++ b/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedRoute.java
@@ -115,6 +115,11 @@ public class ManagedRoute extends ManagedPerformanceCounter implements TimerList
         return id;
     }
 
+    @Override
+    public String getNodePrefixId() {
+        return route.getNodePrefixId();
+    }
+
     @Override
     public String getRouteGroup() {
         return route.getGroup();


(camel) 03/05: CAMEL-20155: camel-core - MBean should use nodePrefixId in their ObjectName (used for avoding duplicate ids and be able to assign fixed ids)

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch node-prefix-id
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 31a51d36a1ffd56d61125af6b01bb8e84dc7304f
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Nov 27 13:54:37 2023 +0100

    CAMEL-20155: camel-core - MBean should use nodePrefixId in their ObjectName (used for avoding duplicate ids and be able to assign fixed ids)
---
 .../src/main/java/org/apache/camel/NamedNode.java  |  5 ++
 .../src/main/java/org/apache/camel/NamedRoute.java |  5 ++
 .../java/org/apache/camel/impl/DefaultModel.java   | 11 ++-
 .../camel/model/OptionalIdentifiedDefinition.java  | 39 ++++++----
 .../DefaultManagementObjectNameStrategy.java       | 14 +++-
 .../management/ManagedRouteNodePrefixIdTest.java   | 88 ++++++++++++++++++++++
 .../ROOT/pages/camel-4x-upgrade-guide-4_3.adoc     |  5 ++
 7 files changed, 149 insertions(+), 18 deletions(-)

diff --git a/core/camel-api/src/main/java/org/apache/camel/NamedNode.java b/core/camel-api/src/main/java/org/apache/camel/NamedNode.java
index 9e40b6ba6c5..aba445e31d1 100644
--- a/core/camel-api/src/main/java/org/apache/camel/NamedNode.java
+++ b/core/camel-api/src/main/java/org/apache/camel/NamedNode.java
@@ -26,6 +26,11 @@ public interface NamedNode extends LineNumberAware {
      */
     String getId();
 
+    /**
+     * Gets the node prefix id.
+     */
+    String getNodePrefixId();
+
     /**
      * Returns a short name for this node which can be useful for ID generation or referring to related resources like
      * images
diff --git a/core/camel-api/src/main/java/org/apache/camel/NamedRoute.java b/core/camel-api/src/main/java/org/apache/camel/NamedRoute.java
index 37ff8e86561..047cd99be2d 100644
--- a/core/camel-api/src/main/java/org/apache/camel/NamedRoute.java
+++ b/core/camel-api/src/main/java/org/apache/camel/NamedRoute.java
@@ -26,6 +26,11 @@ public interface NamedRoute {
      */
     String getRouteId();
 
+    /**
+     * Gets the node prefix id.
+     */
+    String getNodePrefixId();
+
     /**
      * Gets the route endpoint url.
      */
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java b/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java
index e49e4f95459..1a3a0d55e65 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java
@@ -858,9 +858,18 @@ public class DefaultModel implements Model {
             Collection<ProcessorDefinition> col
                     = ProcessorDefinitionHelper.filterTypeInOutputs(route.getOutputs(), ProcessorDefinition.class);
             for (ProcessorDefinition proc : col) {
-                if (id.equals(proc.getId())) {
+                String pid = proc.getId();
+                // match direct by ids
+                if (id.equals(pid)) {
                     return proc;
                 }
+                // try to match via node prefix id
+                if (proc.getNodePrefixId() != null) {
+                    pid = proc.getNodePrefixId() + pid;
+                    if (id.equals(pid)) {
+                        return proc;
+                    }
+                }
             }
         }
         return null;
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/OptionalIdentifiedDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/OptionalIdentifiedDefinition.java
index eef35ec6d1c..f8c42b3e246 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/OptionalIdentifiedDefinition.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/OptionalIdentifiedDefinition.java
@@ -61,6 +61,21 @@ public abstract class OptionalIdentifiedDefinition<T extends OptionalIdentifiedD
         return id;
     }
 
+    @Override
+    public String getNodePrefixId() {
+        // prefix is only for nodes in the route (not the route id)
+        String prefix = null;
+        boolean iAmRoute = this instanceof RouteDefinition;
+        boolean allowPrefix = !iAmRoute && this instanceof ProcessorDefinition;
+        if (allowPrefix) {
+            RouteDefinition route = ProcessorDefinitionHelper.getRoute(this);
+            if (route != null) {
+                prefix = route.getNodePrefixId();
+            }
+        }
+        return prefix;
+    }
+
     /**
      * Sets the id of this node
      */
@@ -153,26 +168,20 @@ public abstract class OptionalIdentifiedDefinition<T extends OptionalIdentifiedD
      * Gets the node id, creating one if not already set.
      */
     public String idOrCreate(NodeIdFactory factory) {
-        // prefix is only for nodes in the route (not the route id)
-        String prefix = null;
-        boolean iAmRoute = this instanceof RouteDefinition;
-        boolean allowPrefix = !iAmRoute && this instanceof ProcessorDefinition;
-        if (allowPrefix) {
-            RouteDefinition route = ProcessorDefinitionHelper.getRoute(this);
-            if (route != null) {
-                prefix = route.getNodePrefixId();
-            }
-        }
         if (id == null) {
             setGeneratedId(factory.createId(this));
         }
 
-        // return with prefix
-        if (prefix != null) {
-            return prefix + id;
-        } else {
-            return id;
+        // return with prefix if configured
+        boolean iAmRoute = this instanceof RouteDefinition;
+        boolean allowPrefix = !iAmRoute && this instanceof ProcessorDefinition;
+        if (allowPrefix) {
+            String prefix = getNodePrefixId();
+            if (prefix != null) {
+                return prefix + id;
+            }
         }
+        return id;
     }
 
     public Boolean getCustomId() {
diff --git a/core/camel-management/src/main/java/org/apache/camel/management/DefaultManagementObjectNameStrategy.java b/core/camel-management/src/main/java/org/apache/camel/management/DefaultManagementObjectNameStrategy.java
index 7815c2f0b19..55b0a3cec69 100644
--- a/core/camel-management/src/main/java/org/apache/camel/management/DefaultManagementObjectNameStrategy.java
+++ b/core/camel-management/src/main/java/org/apache/camel/management/DefaultManagementObjectNameStrategy.java
@@ -289,7 +289,12 @@ public class DefaultManagementObjectNameStrategy implements ManagementObjectName
         buffer.append(domainName).append(":");
         buffer.append(KEY_CONTEXT + "=").append(getContextId(context)).append(",");
         buffer.append(KEY_TYPE + "=").append(TYPE_PROCESSOR).append(",");
-        buffer.append(KEY_NAME + "=").append(ObjectName.quote(definition.getId()));
+        String id = definition.getId();
+        String prefix = definition.getNodePrefixId();
+        if (prefix != null) {
+            id = prefix + id;
+        }
+        buffer.append(KEY_NAME + "=").append(ObjectName.quote(id));
         return createObjectName(buffer);
     }
 
@@ -300,7 +305,12 @@ public class DefaultManagementObjectNameStrategy implements ManagementObjectName
         buffer.append(domainName).append(":");
         buffer.append(KEY_CONTEXT + "=").append(getContextId(context)).append(",");
         buffer.append(KEY_TYPE + "=").append(TYPE_STEP).append(",");
-        buffer.append(KEY_NAME + "=").append(ObjectName.quote(definition.getId()));
+        String id = definition.getId();
+        String prefix = definition.getNodePrefixId();
+        if (prefix != null) {
+            id = prefix + id;
+        }
+        buffer.append(KEY_NAME + "=").append(ObjectName.quote(id));
         return createObjectName(buffer);
     }
 
diff --git a/core/camel-management/src/test/java/org/apache/camel/management/ManagedRouteNodePrefixIdTest.java b/core/camel-management/src/test/java/org/apache/camel/management/ManagedRouteNodePrefixIdTest.java
new file mode 100644
index 00000000000..2b65f1afd99
--- /dev/null
+++ b/core/camel-management/src/test/java/org/apache/camel/management/ManagedRouteNodePrefixIdTest.java
@@ -0,0 +1,88 @@
+/*
+ * 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.camel.management;
+
+import java.util.Set;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.camel.api.management.ManagedCamelContext;
+import org.apache.camel.api.management.mbean.ManagedLogMBean;
+import org.apache.camel.api.management.mbean.ManagedProcessorMBean;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledOnOs;
+import org.junit.jupiter.api.condition.OS;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+@DisabledOnOs(OS.AIX)
+public class ManagedRouteNodePrefixIdTest extends ManagementTestSupport {
+
+    @Test
+    public void testNodeIdPrefix() throws Exception {
+        // get the stats for the route
+        MBeanServer mbeanServer = getMBeanServer();
+
+        Set<ObjectName> set = mbeanServer.queryNames(new ObjectName("*:type=processors,*"), null);
+        assertEquals(4, set.size());
+
+        System.out.println(set);
+
+        // hardcoded ids should also be prefixed
+        ManagedProcessorMBean mb
+                = context.getCamelContextExtension().getContextPlugin(ManagedCamelContext.class)
+                        .getManagedProcessor("aaamyMock");
+        assertEquals("aaamyMock", mb.getProcessorId());
+        assertEquals("foo", mb.getRouteId());
+        assertEquals("aaa", mb.getNodePrefixId());
+        mb = context.getCamelContextExtension().getContextPlugin(ManagedCamelContext.class).getManagedProcessor("bbbmyMock");
+        assertEquals("bbbmyMock", mb.getProcessorId());
+        assertEquals("bar", mb.getRouteId());
+        assertEquals("bbb", mb.getNodePrefixId());
+
+        // auto assigned ids should be prefixed
+        mb = context.getCamelContextExtension().getContextPlugin(ManagedCamelContext.class).getManagedProcessor("aaalog2",
+                ManagedLogMBean.class);
+        assertEquals("aaalog2", mb.getProcessorId());
+        assertEquals("foo", mb.getRouteId());
+        assertEquals("aaa", mb.getNodePrefixId());
+        mb = context.getCamelContextExtension().getContextPlugin(ManagedCamelContext.class).getManagedProcessor("bbblog4",
+                ManagedLogMBean.class);
+        assertEquals("bbblog4", mb.getProcessorId());
+        assertEquals("bar", mb.getRouteId());
+        assertEquals("bbb", mb.getNodePrefixId());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:foo").routeId("foo").nodePrefixId("aaa")
+                        .to("mock:foo").id("myMock")
+                        .log("Hello foo");
+
+                from("direct:bar").nodePrefixId("bbb").routeId("bar")
+                        .to("mock:bar").id("myMock")
+                        .log("Hello bar");
+            }
+        };
+    }
+
+}
diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_3.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_3.adoc
index 29e4cb334bf..87d278e8df1 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_3.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_3.adoc
@@ -45,6 +45,11 @@ from("seda:c")
   .to("seda:d")
 ----
 
+=== camel-management
+
+If the `nodeIdPrefix` has been configured on routes, then the MBeans for the processors will now use the prefix
+in their `ObjectName` also.
+
 === camel-jbang
 
 The `camel transform` command has been renamed to `camel transform route` as this command is used for transforming


(camel) 05/05: Regen

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch node-prefix-id
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 7a4e08615f52a492ac0118efbe2394e52ebbe805
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Nov 27 14:14:12 2023 +0100

    Regen
---
 .../org/apache/camel/builder/component/ComponentsBuilderFactory.java  | 2 +-
 .../camel/builder/component/dsl/SmbComponentBuilderFactory.java       | 2 +-
 dsl/camel-componentdsl/src/generated/resources/metadata.json          | 2 +-
 .../org/apache/camel/builder/endpoint/StaticEndpointBuilders.java     | 4 ++--
 .../apache/camel/builder/endpoint/dsl/SmbEndpointBuilderFactory.java  | 4 ++--
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java
index d0fe9736870..3bb76cfc9b2 100644
--- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java
+++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java
@@ -3672,7 +3672,7 @@ public interface ComponentsBuilderFactory {
      * Receive files from SMB (Server Message Block) shares.
      * 
      * Category: file
-     * Since: 4.3.0-SNAPSHOT
+     * Since: 4.3
      * Maven coordinates: org.apache.camel:camel-smb
      * 
      * @return the dsl builder
diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SmbComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SmbComponentBuilderFactory.java
index f040929a404..406178c233e 100644
--- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SmbComponentBuilderFactory.java
+++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SmbComponentBuilderFactory.java
@@ -35,7 +35,7 @@ public interface SmbComponentBuilderFactory {
      * Receive files from SMB (Server Message Block) shares.
      * 
      * Category: file
-     * Since: 4.3.0-SNAPSHOT
+     * Since: 4.3
      * Maven coordinates: org.apache.camel:camel-smb
      * 
      * @return the dsl builder
diff --git a/dsl/camel-componentdsl/src/generated/resources/metadata.json b/dsl/camel-componentdsl/src/generated/resources/metadata.json
index 382dfb1c0dd..c7cca883d96 100644
--- a/dsl/camel-componentdsl/src/generated/resources/metadata.json
+++ b/dsl/camel-componentdsl/src/generated/resources/metadata.json
@@ -6045,7 +6045,7 @@
     "title": "SMB",
     "description": "Receive files from SMB (Server Message Block) shares.",
     "deprecated": false,
-    "firstVersion": "4.3.0-SNAPSHOT",
+    "firstVersion": "4.3.0",
     "label": "file",
     "javaType": "org.apache.camel.component.smb.SmbComponent",
     "supportLevel": "Preview",
diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
index 8cbb435ae82..5922c062dfe 100644
--- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
+++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
@@ -13029,7 +13029,7 @@ public class StaticEndpointBuilders {
      * Receive files from SMB (Server Message Block) shares.
      * 
      * Category: file
-     * Since: 4.3.0-SNAPSHOT
+     * Since: 4.3
      * Maven coordinates: org.apache.camel:camel-smb
      * 
      * Syntax: <code>smb:hostname:port/shareName</code>
@@ -13056,7 +13056,7 @@ public class StaticEndpointBuilders {
      * Receive files from SMB (Server Message Block) shares.
      * 
      * Category: file
-     * Since: 4.3.0-SNAPSHOT
+     * Since: 4.3
      * Maven coordinates: org.apache.camel:camel-smb
      * 
      * Syntax: <code>smb:hostname:port/shareName</code>
diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SmbEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SmbEndpointBuilderFactory.java
index f98f61cb394..c350e586ed1 100644
--- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SmbEndpointBuilderFactory.java
+++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SmbEndpointBuilderFactory.java
@@ -868,7 +868,7 @@ public interface SmbEndpointBuilderFactory {
          * Receive files from SMB (Server Message Block) shares.
          * 
          * Category: file
-         * Since: 4.3.0-SNAPSHOT
+         * Since: 4.3
          * Maven coordinates: org.apache.camel:camel-smb
          * 
          * Syntax: <code>smb:hostname:port/shareName</code>
@@ -894,7 +894,7 @@ public interface SmbEndpointBuilderFactory {
          * Receive files from SMB (Server Message Block) shares.
          * 
          * Category: file
-         * Since: 4.3.0-SNAPSHOT
+         * Since: 4.3
          * Maven coordinates: org.apache.camel:camel-smb
          * 
          * Syntax: <code>smb:hostname:port/shareName</code>


(camel) 02/05: CAMEL-20155: camel-core - Add nodePrefixId to mbean.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch node-prefix-id
in repository https://gitbox.apache.org/repos/asf/camel.git

commit a0a49e102fa4b54e0c630b0788a685010b4ed849
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Nov 27 12:56:10 2023 +0100

    CAMEL-20155: camel-core - Add nodePrefixId to mbean.
---
 .../apache/camel/api/management/mbean/ManagedProcessorMBean.java  | 3 +++
 .../java/org/apache/camel/management/mbean/ManagedProcessor.java  | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedProcessorMBean.java b/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedProcessorMBean.java
index 1e0c899b613..f1eb56649c1 100644
--- a/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedProcessorMBean.java
+++ b/core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedProcessorMBean.java
@@ -33,6 +33,9 @@ public interface ManagedProcessorMBean extends ManagedPerformanceCounterMBean {
     @ManagedAttribute(description = "Route ID")
     String getRouteId();
 
+    @ManagedAttribute(description = "Node Prefix ID")
+    String getNodePrefixId();
+
     @ManagedAttribute(description = "Step ID")
     String getStepId();
 
diff --git a/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedProcessor.java b/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedProcessor.java
index f88f7cde86f..a8e6843110e 100644
--- a/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedProcessor.java
+++ b/core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedProcessor.java
@@ -166,6 +166,14 @@ public class ManagedProcessor extends ManagedPerformanceCounter implements Manag
         return null;
     }
 
+    @Override
+    public String getNodePrefixId() {
+        if (route != null) {
+            return route.getNodePrefixId();
+        }
+        return null;
+    }
+
     @Override
     public String getProcessorId() {
         return id;