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

davsclaus pushed a commit to branch ih
in repository https://gitbox.apache.org/repos/asf/camel.git

commit aa66ebd75557ecf7b7726e8e112e15333d44fa65
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Nov 20 18:07:58 2025 +0100

    CAMEL-22693: Mark up EIP and endpoint headers that are of importance to 
make tooling, trouble shooting and development easier.
---
 .../org/apache/camel/catalog/components/file.json  |  2 +-
 .../camel/catalog/main/important-headers.json      |  1 +
 .../org/apache/camel/component/file/file.json      |  2 +-
 .../apache/camel/component/file/FileConstants.java |  2 +-
 .../apache/camel/util/ImportantHeaderUtils.java    |  1 +
 .../core/commands/action/CamelHistoryAction.java   | 65 ++++++++++++++++------
 6 files changed, 54 insertions(+), 19 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/file.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/file.json
index 6a455a342190..9836d6862e19 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/file.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/file.json
@@ -31,7 +31,7 @@
     "healthCheckProducerEnabled": { "index": 4, "kind": "property", 
"displayName": "Health Check Producer Enabled", "group": "health", "label": 
"health", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true, 
"description": "Used for enabling or disabling all producer based health checks 
from this component. Notice: Camel has by default disabled all producer based 
health-checks. You can turn on producer [...]
   },
   "headers": {
-    "CamelFileLength": { "index": 0, "kind": "header", "displayName": "", 
"group": "consumer", "label": "consumer", "required": false, "javaType": 
"long", "deprecated": false, "deprecationNote": "", "autowired": false, 
"secret": false, "description": "A long value containing the file size.", 
"constantName": "org.apache.camel.component.file.FileConstants#FILE_LENGTH" },
+    "CamelFileLength": { "index": 0, "kind": "header", "displayName": "", 
"group": "consumer", "label": "consumer", "required": false, "javaType": 
"long", "deprecated": false, "deprecationNote": "", "autowired": false, 
"secret": false, "important": true, "description": "A long value containing the 
file size.", "constantName": 
"org.apache.camel.component.file.FileConstants#FILE_LENGTH" },
     "CamelFileLastModified": { "index": 1, "kind": "header", "displayName": 
"", "group": "consumer", "label": "consumer", "required": false, "javaType": 
"long", "deprecated": false, "deprecationNote": "", "autowired": false, 
"secret": false, "description": "A Long value containing the last modified 
timestamp of the file.", "constantName": 
"org.apache.camel.component.file.FileConstants#FILE_LAST_MODIFIED" },
     "CamelFileLocalWorkPath": { "index": 2, "kind": "header", "displayName": 
"", "group": "producer", "label": "producer", "required": false, "javaType": 
"File", "deprecated": false, "deprecationNote": "", "autowired": false, 
"secret": false, "description": "The local work path", "constantName": 
"org.apache.camel.component.file.FileConstants#FILE_LOCAL_WORK_PATH" },
     "CamelFileNameOnly": { "index": 3, "kind": "header", "displayName": "", 
"group": "consumer", "label": "consumer", "required": false, "javaType": 
"String", "deprecated": false, "deprecationNote": "", "autowired": false, 
"secret": false, "description": "Only the file name (the name with no leading 
paths).", "constantName": 
"org.apache.camel.component.file.FileConstants#FILE_NAME_ONLY" },
diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/important-headers.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/important-headers.json
index d31b507e34eb..ba594b21238e 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/important-headers.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/important-headers.json
@@ -1,5 +1,6 @@
 [
   "CamelAggregatedSize",
+  "CamelFileLength",
   "CamelFileName",
   "CamelSplitIndex",
   "CamelSplitSize"
diff --git 
a/components/camel-file/src/generated/resources/META-INF/org/apache/camel/component/file/file.json
 
b/components/camel-file/src/generated/resources/META-INF/org/apache/camel/component/file/file.json
index 6a455a342190..9836d6862e19 100644
--- 
a/components/camel-file/src/generated/resources/META-INF/org/apache/camel/component/file/file.json
+++ 
b/components/camel-file/src/generated/resources/META-INF/org/apache/camel/component/file/file.json
@@ -31,7 +31,7 @@
     "healthCheckProducerEnabled": { "index": 4, "kind": "property", 
"displayName": "Health Check Producer Enabled", "group": "health", "label": 
"health", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true, 
"description": "Used for enabling or disabling all producer based health checks 
from this component. Notice: Camel has by default disabled all producer based 
health-checks. You can turn on producer [...]
   },
   "headers": {
-    "CamelFileLength": { "index": 0, "kind": "header", "displayName": "", 
"group": "consumer", "label": "consumer", "required": false, "javaType": 
"long", "deprecated": false, "deprecationNote": "", "autowired": false, 
"secret": false, "description": "A long value containing the file size.", 
"constantName": "org.apache.camel.component.file.FileConstants#FILE_LENGTH" },
+    "CamelFileLength": { "index": 0, "kind": "header", "displayName": "", 
"group": "consumer", "label": "consumer", "required": false, "javaType": 
"long", "deprecated": false, "deprecationNote": "", "autowired": false, 
"secret": false, "important": true, "description": "A long value containing the 
file size.", "constantName": 
"org.apache.camel.component.file.FileConstants#FILE_LENGTH" },
     "CamelFileLastModified": { "index": 1, "kind": "header", "displayName": 
"", "group": "consumer", "label": "consumer", "required": false, "javaType": 
"long", "deprecated": false, "deprecationNote": "", "autowired": false, 
"secret": false, "description": "A Long value containing the last modified 
timestamp of the file.", "constantName": 
"org.apache.camel.component.file.FileConstants#FILE_LAST_MODIFIED" },
     "CamelFileLocalWorkPath": { "index": 2, "kind": "header", "displayName": 
"", "group": "producer", "label": "producer", "required": false, "javaType": 
"File", "deprecated": false, "deprecationNote": "", "autowired": false, 
"secret": false, "description": "The local work path", "constantName": 
"org.apache.camel.component.file.FileConstants#FILE_LOCAL_WORK_PATH" },
     "CamelFileNameOnly": { "index": 3, "kind": "header", "displayName": "", 
"group": "consumer", "label": "consumer", "required": false, "javaType": 
"String", "deprecated": false, "deprecationNote": "", "autowired": false, 
"secret": false, "description": "Only the file name (the name with no leading 
paths).", "constantName": 
"org.apache.camel.component.file.FileConstants#FILE_NAME_ONLY" },
diff --git 
a/components/camel-file/src/main/java/org/apache/camel/component/file/FileConstants.java
 
b/components/camel-file/src/main/java/org/apache/camel/component/file/FileConstants.java
index 027fd8a5e59a..b00f3cc0da45 100644
--- 
a/components/camel-file/src/main/java/org/apache/camel/component/file/FileConstants.java
+++ 
b/components/camel-file/src/main/java/org/apache/camel/component/file/FileConstants.java
@@ -21,7 +21,7 @@ import org.apache.camel.spi.Metadata;
 
 public final class FileConstants {
 
-    @Metadata(label = "consumer", description = "A `long` value containing the 
file size.", javaType = "long")
+    @Metadata(label = "consumer", description = "A `long` value containing the 
file size.", javaType = "long", important = true)
     public static final String FILE_LENGTH = Exchange.FILE_LENGTH;
     @Metadata(label = "consumer", description = "A `Long` value containing the 
last modified timestamp of the file.",
               javaType = "long")
diff --git 
a/core/camel-util/src/main/java/org/apache/camel/util/ImportantHeaderUtils.java 
b/core/camel-util/src/main/java/org/apache/camel/util/ImportantHeaderUtils.java
index dac11bfe12e5..e8957dda6c67 100644
--- 
a/core/camel-util/src/main/java/org/apache/camel/util/ImportantHeaderUtils.java
+++ 
b/core/camel-util/src/main/java/org/apache/camel/util/ImportantHeaderUtils.java
@@ -28,6 +28,7 @@ public final class ImportantHeaderUtils {
                     // Generated by camel build tools - do NOT edit this list!
                     // IMPORTANT-HEADER-KEYS: START
                     "CamelAggregatedSize",
+                    "CamelFileLength",
                     "CamelFileName",
                     "CamelSplitIndex",
                     "CamelSplitSize"
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelHistoryAction.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelHistoryAction.java
index cb156faba94e..1646f8dcdf50 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelHistoryAction.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelHistoryAction.java
@@ -22,7 +22,9 @@ import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
+import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.StringJoiner;
 
@@ -178,20 +180,59 @@ public class CamelHistoryAction extends 
ActionWatchCommand {
             return "Exception: " + r.exception.getString("message");
         }
         if (r.last) {
-            return r.failed ? "failed" : "success";
+            return r.failed ? "Failed" : "Success";
         }
-        return importantMessage(r);
-    }
 
-    private String importantMessage(Row r) {
+        Map<String, String> map = extractImportant(r);
+        if (map.isEmpty()) {
+            return null;
+        }
         StringJoiner sj = new StringJoiner(" ");
+
+        // special for split
+        String si = map.remove("CamelSplitIndex");
+        String sv = map.remove("CamelSplitSize");
+        if (si != null && sv != null) {
+            int num = Integer.parseInt(sv) - 1;
+            sj.add("Split (" + si + "/" + num + ")");
+        } else if (si != null) {
+            sj.add("Split (" + si + ")");
+        }
+        // special for file
+        String fn = map.remove("CamelFileName");
+        String fs = map.remove("CamelFileLength");
+        if (fn != null && fs != null) {
+            String line = "File: " + fn + " (" + fs + " bytes)";
+            if (usedImportant.add(line)) {
+                sj.add(line);
+            }
+        } else if (fn != null) {
+            String line = "File: " + fn;
+            if (usedImportant.add(line)) {
+                sj.add(line);
+            }
+        }
+
+        map.forEach((k,v) -> {
+            String line = k + "=" + v;
+            if (usedImportant.add(line)) {
+                // avoid duplicates so only show unique
+                sj.add(k + "=" + v);
+            }
+        });
+
+        return sj.toString();
+    }
+
+    private Map<String, String> extractImportant(Row r) {
+        Map<String, String> answer = new LinkedHashMap<>();
+
         JsonArray arr = r.message.getCollection("exchangeProperties");
         if (arr != null) {
             for (int i = 0; i < arr.size(); i++) {
                 JsonObject jo = (JsonObject) arr.get(i);
                 if (jo.getBooleanOrDefault("important", false)) {
-                    String line = jo.getString("key") + "=" + 
jo.getString("value");
-                    sj.add(line);
+                    answer.put(jo.getString("key"), jo.getString("value"));
                 }
             }
         }
@@ -200,19 +241,11 @@ public class CamelHistoryAction extends 
ActionWatchCommand {
             for (int i = 0; i < arr.size(); i++) {
                 JsonObject jo = (JsonObject) arr.get(i);
                 if (jo.getBooleanOrDefault("important", false)) {
-                    String line = jo.getString("key") + "=" + 
jo.getString("value");
-                    sj.add(line);
+                    answer.put(jo.getString("key"), jo.getString("value"));
                 }
             }
         }
-        if (sj.length() > 0) {
-            String line = sj.toString();
-            // avoid printing the same line over and over again
-            if (usedImportant.add(line)) {
-                return line;
-            }
-        }
-        return null;
+        return answer;
     }
 
     protected List<List<Row>> loadRows() throws Exception {

Reply via email to