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 71d5414be9c3d1b308d812d29a6665573640f77d Author: Claus Ibsen <[email protected]> AuthorDate: Sun Nov 23 17:46:09 2025 +0100 CAMEL-22693: Mark up EIP and endpoint headers that are of importance to make tooling, trouble shooting and development easier. --- .../core/commands/action/CamelHistoryAction.java | 31 +++++++++++++++++----- 1 file changed, 25 insertions(+), 6 deletions(-) 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 e477e2746d58..204a629c5a3c 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 @@ -64,9 +64,11 @@ public class CamelHistoryAction extends ActionWatchCommand { description = "Depth of tracing. 0=Created+Completed. 1=All events on 1st route, 2=All events on 1st+2nd depth, and so on. 9 = all events on every depth.") int depth; - private final CamelCatalog camelCatalog = new DefaultCamelCatalog(true); + @CommandLine.Option(names = { "--limit-split" }, + description = "Limit Split to a maximum number of entries to be displayed") + int limitSplit; - // TODO: option to collapse split (to cut very large split) + private final CamelCatalog camelCatalog = new DefaultCamelCatalog(true); public CamelHistoryAction(CamelJBangMain main) { super(main); @@ -135,15 +137,32 @@ public class CamelHistoryAction extends ActionWatchCommand { return 0; } - private boolean filterDepth(Row row) { + private boolean filterDepth(Row r) { if (depth >= 9) { return true; } if (depth == 0) { // special with only created/completed - return row.nodeLevel == 1 && (row.first || row.last); + return r.nodeLevel == 1 && (r.first || r.last); + } + return r.nodeLevel <= depth; + } + + private boolean filterSplit(Row r) { + if (limitSplit <= 0) { + return true; + } + JsonArray arr = r.message.getCollection("exchangeProperties"); + if (arr != null) { + for (int i = 0; i < arr.size(); i++) { + JsonObject jo = (JsonObject) arr.get(i); + if ("CamelSplitIndex".equals(jo.getString("key"))) { + long idx = jo.getLongOrDefault("value", Long.MAX_VALUE); + return idx < limitSplit; + } + } } - return row.nodeLevel <= depth; + return true; } private String getId(Row r) { @@ -303,7 +322,7 @@ public class CamelHistoryAction extends ActionWatchCommand { List<Row> answer = new ArrayList<>(); for (Row r : rows) { - if (filterDepth(r)) { + if (filterDepth(r) && filterSplit(r)) { answer.add(r); } }
