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 2025/12/08 07:16:29 UTC
(camel) 01/02: CAMEL-22703: camel-jbang - history to have it mode to show message data like debugger
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch it
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 7f82aea6dbb965a3d284d903df3665c3f8ff1b88
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Dec 8 07:20:26 2025 +0100
CAMEL-22703: camel-jbang - history to have it mode to show message data like debugger
---
.../jbang/core/commands/action/CamelHistoryAction.java | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 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 15374abe563b..6e180b4fe317 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
@@ -203,13 +203,16 @@ public class CamelHistoryAction extends ActionWatchCommand {
return 0;
}
- private void doRead(Console c, AtomicBoolean quit, AtomicInteger index) {
+ private void doRead(Console c, AtomicBoolean quit, AtomicInteger index, AtomicBoolean refresh) {
do {
String line = c.readLine();
if (line != null) {
line = line.trim();
if ("q".equalsIgnoreCase(line) || "quit".equalsIgnoreCase(line) || "exit".equalsIgnoreCase(line)) {
quit.set(true);
+ } else if ("r".equalsIgnoreCase(line)) {
+ refresh.set(true);
+ index.set(0);
} else if ("p".equalsIgnoreCase(line)) {
if (index.get() > 0) {
index.decrementAndGet();
@@ -230,8 +233,9 @@ public class CamelHistoryAction extends ActionWatchCommand {
private Integer doInteractiveCall(List<Row> rows) throws Exception {
// read CLI input from user
final AtomicInteger index = new AtomicInteger();
+ final AtomicBoolean refresh = new AtomicBoolean();
final Console c = System.console();
- Thread t2 = new Thread(() -> doRead(c, quit, index), "ReadCommand");
+ Thread t2 = new Thread(() -> doRead(c, quit, index, refresh), "ReadCommand");
t2.start();
tableHelper = new MessageTableHelper();
@@ -242,6 +246,13 @@ public class CamelHistoryAction extends ActionWatchCommand {
do {
if (!waitForUser.get()) {
+ if (refresh.compareAndSet(true, false)) {
+ var reloaded = loadRows();
+ if (reloaded.size() == 1) {
+ rows = reloaded.get(0);
+ }
+ }
+
clearScreen();
Row first = rows.get(0);
String ago = TimeUtils.printSince(first.timestamp);
@@ -273,7 +284,7 @@ public class CamelHistoryAction extends ActionWatchCommand {
String msg
= " Message History (" + pos + "/" + total
- + "). Press ENTER to continue (n = next (default), p = previous, number = jump to index, q = quit).";
+ + "). Press ENTER to continue (n = next (default), p = previous, number = jump to index, r = refresh, q = quit).";
if (loggingColor) {
AnsiConsole.out().println(Ansi.ansi().a(Ansi.Attribute.INTENSITY_BOLD).a(msg).reset());
} else {