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 3e1c36b9d1f CAMEL-18406: camel-jbang - Status command
3e1c36b9d1f is described below
commit 3e1c36b9d1f1c8923ed3a6e3ded38db2a002b20e
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Aug 25 09:36:22 2022 +0200
CAMEL-18406: camel-jbang - Status command
---
.../apache/camel/dsl/jbang/core/commands/Run.java | 23 +++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
index fd3da1bfd6b..f933ee34aab 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
+++
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
@@ -586,12 +586,23 @@ class Run extends CamelCommand {
}
// update status file with details from the context console
try {
+ JsonObject root = new JsonObject();
DevConsole dc =
main.getCamelContext().adapt(ExtendedCamelContext.class)
.getDevConsoleResolver().resolveDevConsole("context");
DevConsole dc2 =
main.getCamelContext().adapt(ExtendedCamelContext.class)
.getDevConsoleResolver().resolveDevConsole("route");
int ready = 0;
int total = 0;
+ if (dc != null && dc2 != null) {
+ JsonObject json = (JsonObject)
dc.call(DevConsole.MediaType.JSON);
+ JsonObject json2 = (JsonObject)
dc2.call(DevConsole.MediaType.JSON);
+ if (json != null && json2 != null) {
+ root.put("context", json);
+ json.put("runtime", "camel-jbang");
+ root.put("routes", json2.get("routes"));
+ IOHelper.writeText(root.toJson(), statusFile);
+ }
+ }
// and health-check readiness
Collection<HealthCheck.Result> res =
HealthCheckHelper.invokeReadiness(main.getCamelContext());
for (var r : res) {
@@ -603,17 +614,7 @@ class Run extends CamelCommand {
JsonObject hc = new JsonObject();
hc.put("ready", ready);
hc.put("total", total);
- if (dc != null && dc2 != null) {
- JsonObject json = (JsonObject)
dc.call(DevConsole.MediaType.JSON);
- JsonObject json2 = (JsonObject)
dc2.call(DevConsole.MediaType.JSON);
- if (json != null && json2 != null) {
- JsonObject root = new JsonObject();
- root.put("context", json);
- root.put("routes", json2.get("routes"));
- root.put("healthChecks", hc);
- IOHelper.writeText(root.toJson(), statusFile);
- }
- }
+ root.put("healthChecks", hc);
} catch (Throwable e) {
// ignore
}