This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 10e3860a2987 CAMEL-23615: Add startTimestamp to context dev console
10e3860a2987 is described below
commit 10e3860a298727ad65a120d71cd51916931d6004
Author: Claus Ibsen <[email protected]>
AuthorDate: Tue May 26 22:49:33 2026 +0200
CAMEL-23615: Add startTimestamp to context dev console
Adds startTimestamp (epoch millis) to the context dev console JSON
output using CamelContext.getClock().get(ContextEvents.START). Also
adds a human-readable "Started:" line to the text output.
Closes #23541
---
.../org/apache/camel/impl/console/ContextDevConsole.java | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git
a/core/camel-console/src/main/java/org/apache/camel/impl/console/ContextDevConsole.java
b/core/camel-console/src/main/java/org/apache/camel/impl/console/ContextDevConsole.java
index 9e590550b410..84b1834e2834 100644
---
a/core/camel-console/src/main/java/org/apache/camel/impl/console/ContextDevConsole.java
+++
b/core/camel-console/src/main/java/org/apache/camel/impl/console/ContextDevConsole.java
@@ -22,8 +22,10 @@ import java.util.Locale;
import java.util.Map;
import java.util.Set;
+import org.apache.camel.ContextEvents;
import org.apache.camel.api.management.ManagedCamelContext;
import org.apache.camel.api.management.mbean.ManagedCamelContextMBean;
+import org.apache.camel.clock.Clock;
import org.apache.camel.spi.ReloadStrategy;
import org.apache.camel.spi.ResourceReloadStrategy;
import org.apache.camel.spi.annotations.DevConsole;
@@ -54,6 +56,10 @@ public class ContextDevConsole extends AbstractDevConsole {
if (getCamelContext().getDescription() != null) {
sb.append(String.format("%n %s",
getCamelContext().getDescription()));
}
+ Clock startClock =
getCamelContext().getClock().get(ContextEvents.START);
+ if (startClock != null) {
+ sb.append(String.format("%n Started: %s", startClock.asDate()));
+ }
sb.append("\n");
ManagedCamelContext mcc =
getCamelContext().getCamelContextExtension().getContextPlugin(ManagedCamelContext.class);
@@ -135,7 +141,12 @@ public class ContextDevConsole extends AbstractDevConsole {
root.put("version", getCamelContext().getVersion());
root.put("state", getCamelContext().getStatus().name());
root.put("phase",
getCamelContext().getCamelContextExtension().getStatusPhase());
- root.put("uptime", getCamelContext().getUptime().toMillis());
+ long uptimeMillis = getCamelContext().getUptime().toMillis();
+ Clock startClock =
getCamelContext().getClock().get(ContextEvents.START);
+ if (startClock != null) {
+ root.put("startTimestamp", startClock.getCreated());
+ }
+ root.put("uptime", uptimeMillis);
root.put("devMode",
getCamelContext().hasService(ResourceReloadStrategy.class) != null);
ManagedCamelContext mcc =
getCamelContext().getCamelContextExtension().getContextPlugin(ManagedCamelContext.class);