diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json index 64c944a9d65a3..8cb1b1af58f7f 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json @@ -55,7 +55,7 @@ { "name": "camel.main.contextReloadEnabled", "required": false, "description": "Used for enabling context reloading. If enabled then Camel allow external systems such as security vaults (AWS secrets manager, etc.) to trigger refreshing Camel by updating property placeholders and reload all existing routes to take changes into effect.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": false, "secret": false }, { "name": "camel.main.description", "required": false, "description": "Sets the description (intended for humans) of the Camel application.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "string", "javaType": "java.lang.String", "secret": false }, { "name": "camel.main.devConsoleEnabled", "required": false, "description": "Whether to enable developer console (requires camel-console on classpath). The developer console is only for assisting during development. This is NOT for production usage.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": false, "secret": false, "security": "insecure:dev" }, - { "name": "camel.main.dumpRoutes", "required": false, "description": "If dumping is enabled then Camel will during startup dump all loaded routes (incl rests and route templates) represented as XML\/YAML DSL into the log. This is intended for trouble shooting or to assist during development. Sensitive information that may be configured in the route endpoints could potentially be included in the dump output and is therefore not recommended being used for production usage. This requires to have camel-xml-io\/camel-yaml-io on the classpath to be able to dump the routes as XML\/YAML. You can also use JSon which dumps the route structure in JSon. The JSon does not represent Camel DSL but it useful for tooling to understand the structure of the routes and how EIPs are nested together. You can also use png to save route diagrams as PNG image files either all combined in a single file (default camel-route-diagrams.png) or to a given folder, where routes are grouped by source file name(s) and saved as corresponding .png files.\\ This requires to have camel-diagram on the classpath to be able to render PNG diagrams.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "enum", "javaType": "java.lang.String", "secret": false, "enum": [ "xml", "yaml", "json", "png" ] }, + { "name": "camel.main.dumpRoutes", "required": false, "description": "If dumping is enabled then Camel will during startup dump all loaded routes (incl rests and route templates) represented as XML\/YAML DSL into the log. This is intended for trouble shooting or to assist during development. Sensitive information that may be configured in the route endpoints could potentially be included in the dump output and is therefore not recommended being used for production usage. This requires to have camel-xml-io\/camel-yaml-io on the classpath to be able to dump the routes as XML\/YAML. You can also use JSon which dumps the route structure in JSon. The JSon does not represent Camel DSL but it useful for tooling to understand the structure of the routes and how EIPs are nested together. You can also use png to save route diagrams as PNG image files either all combined in a single file (default camel-route-diagrams.png) or to a given folder, where routes are grouped by source file name(s) and saved as corresponding .png files. This requires to have camel-diagram on the classpath to be able to render PNG diagrams.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "enum", "javaType": "java.lang.String", "secret": false, "enum": [ "xml", "yaml", "json", "png" ] }, { "name": "camel.main.dumpRoutesGeneratedIds", "required": false, "description": "Whether to include auto generated IDs in the dumped output. Default is false.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": false, "secret": false }, { "name": "camel.main.dumpRoutesInclude", "required": false, "description": "Controls what to include in output for route dumping. Possible values: all, routes, rests, routeConfigurations, routeTemplates, beans, dataFormats. Multiple values can be separated by comma. Default is routes.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "routes", "secret": false }, { "name": "camel.main.dumpRoutesLog", "required": false, "description": "Whether to log route dumps to Logger", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": true, "secret": false }, diff --git a/components/camel-diagram/src/main/docs/diagram.adoc b/components/camel-diagram/src/main/docs/diagram.adoc index 814acfacb8121..d4517d27a0c8e 100644 --- a/components/camel-diagram/src/main/docs/diagram.adoc +++ b/components/camel-diagram/src/main/docs/diagram.adoc @@ -10,13 +10,11 @@ *Since Camel {since}* The Diagram module provides route diagram rendering capabilities for Apache Camel routes. -It can generate visual route diagrams as PNG images or text-based tree representations -from route structure data. +It can generate visual route diagrams as PNG images representations from route structure data. == Features * Render route diagrams as PNG images with colored nodes and scope boxes -* Generate text-based tree diagrams for terminal output * Support for all Camel EIPs: choice, doTry/doCatch, filter, split, loop, multicast, and more * Scope boxes visually group branching and scoping EIPs * Multiple color themes: dark, light, transparent, or custom @@ -70,16 +68,6 @@ BufferedImage image = renderer.renderDiagram(List.of(lr), lr.maxY + RouteDiagram ImageIO.write(image, "PNG", new File("diagram.png")); ---- -=== Text diagram - -For terminal or log output, generate a text-based tree: - -[source,java] ----- -List lines = renderer.printTextDiagram(routes); -lines.forEach(System.out::println); ----- - === With Camel JBang The diagram rendering is used by the `camel cmd route-diagram` command in Camel JBang: @@ -96,11 +84,10 @@ The following built-in themes are available: * `dark` - dark background (default) * `light` - light background * `transparent` - transparent background -* `text` - to use tree diagram instead of visual diagram Custom colors can be specified using the format: -[source,text] +[source,properties] ---- bg=#1e1e1e:from=#2e7d32:to=#1565c0:eip=#8957e5:choice=#d29922 ---- @@ -113,12 +100,3 @@ To use dark theme ---- camel cmd route-diagram MyRoute.java --theme=dark ---- - -To print textual tree diagram instead of visual - -[source,bash] ----- -camel cmd route-diagram MyRoute.java --theme=tree ----- - -TIP: You can also show diagrams for an existing running integration by executing `camel cmd diagram`. diff --git a/components/camel-diagram/src/main/java/org/apache/camel/diagram/DiagramDevConsole.java b/components/camel-diagram/src/main/java/org/apache/camel/diagram/DiagramDevConsole.java index 261ae7e50646c..74265961117b2 100644 --- a/components/camel-diagram/src/main/java/org/apache/camel/diagram/DiagramDevConsole.java +++ b/components/camel-diagram/src/main/java/org/apache/camel/diagram/DiagramDevConsole.java @@ -20,7 +20,6 @@ import java.util.Map; import java.util.StringJoiner; -import org.apache.camel.console.DevConsoleRegistry; import org.apache.camel.spi.RouteDiagramDumper; import org.apache.camel.spi.annotations.DevConsole; import org.apache.camel.support.PluginHelper; @@ -36,7 +35,7 @@ public class DiagramDevConsole extends AbstractDevConsole { public static final String FILTER = "filter"; /** - * Theme to use: dark, light, or text + * Theme to use: dark or light */ public static final String THEME = "theme"; @@ -60,6 +59,11 @@ public class DiagramDevConsole extends AbstractDevConsole { */ public static final String METRIC = "metric"; + /** + * Whether to auto-refresh page every 5 seconds + */ + public static final String AUTO_REFRESH = "autoRefresh"; + public DiagramDevConsole() { super("camel", "route-diagram", "Route Diagram", "Visual route diagrams"); } @@ -76,24 +80,24 @@ protected String doCallText(Map options) { .parseInt(options.getOrDefault(NODE_WIDTH, "" + RouteDiagramLayoutEngine.DEFAULT_BOX_WIDTH).toString()); String nodeLabel = (String) options.getOrDefault(NODE_LABEL, RouteDiagramDumper.NodeLabelMode.CODE.name()); boolean metric = "true".equalsIgnoreCase((String) options.getOrDefault(METRIC, "true")); + boolean refresh = "true".equalsIgnoreCase((String) options.getOrDefault(AUTO_REFRESH, "true")); - // special for text - if ("text".equalsIgnoreCase(theme)) { - sj.add(renderTextTheme(filter)); - } else { - try { - RouteDiagramDumper dumper = PluginHelper.getRouteDiagramDumper(getCamelContext()); - BufferedImage image = dumper.dumpRoutesAsImage(filter, RouteDiagramDumper.Theme.valueOf(theme.toUpperCase()), - metric, RouteDiagramDumper.NodeLabelMode.valueOf(nodeLabel.toUpperCase()), nodeWidth, fontSize); - String base64 = dumper.imageToBase64(image); - // For HTML embedding: - String html = String.format( - "\n\n\"Route\n\n", - base64); - sj.add(html); - } catch (Exception e) { - // ignore + try { + RouteDiagramDumper dumper = PluginHelper.getRouteDiagramDumper(getCamelContext()); + BufferedImage image = dumper.dumpRoutesAsImage(filter, RouteDiagramDumper.Theme.valueOf(theme.toUpperCase()), + metric, RouteDiagramDumper.NodeLabelMode.valueOf(nodeLabel.toUpperCase()), nodeWidth, fontSize); + String base64 = dumper.imageToBase64(image); + // For HTML embedding: + String html = String.format( + " \n \"Route\n \n", + base64); + if (refresh) { + html = "\n" + html; } + html = "\n" + html + "\n"; + sj.add(html); + } catch (Exception e) { + // ignore } return sj.toString(); @@ -124,18 +128,4 @@ protected Map doCallJson(Map options) { return root; } - private String renderTextTheme(String filter) { - final StringJoiner sj = new StringJoiner("\n"); - - org.apache.camel.console.DevConsole dc - = getCamelContext().getCamelContextExtension().getContextPlugin(DevConsoleRegistry.class) - .resolveById("route-structure"); - JsonObject root = (JsonObject) dc.call(MediaType.JSON, Map.of("filter", filter)); - var routes = RouteDiagramHelper.parseRoutes(root); - RouteDiagramRenderer renderer = new RouteDiagramRenderer(); - var lines = renderer.printTextDiagram(routes); - lines.forEach(sj::add); - sj.add(""); - return sj.toString(); - } } diff --git a/components/camel-diagram/src/main/java/org/apache/camel/diagram/RouteDiagramRenderer.java b/components/camel-diagram/src/main/java/org/apache/camel/diagram/RouteDiagramRenderer.java index d261ffbbd135b..89f4839c5158d 100644 --- a/components/camel-diagram/src/main/java/org/apache/camel/diagram/RouteDiagramRenderer.java +++ b/components/camel-diagram/src/main/java/org/apache/camel/diagram/RouteDiagramRenderer.java @@ -451,11 +451,17 @@ private Color getNodeColor(String type, DiagramColors colors) { }; } - public List printTextDiagram(List routes) { + /** + * Used for testing + */ + List printTextDiagram(List routes) { return printTextDiagram(routes, RouteDiagramLayoutEngine.NodeLabelMode.CODE); } - public List printTextDiagram(List routes, RouteDiagramLayoutEngine.NodeLabelMode mode) { + /** + * Used for testing + */ + List printTextDiagram(List routes, RouteDiagramLayoutEngine.NodeLabelMode mode) { List lines = new ArrayList<>(); for (RouteInfo route : routes) { lines.add(""); diff --git a/components/camel-diagram/src/test/java/org/apache/camel/diagram/DiagramDevConsoleTest.java b/components/camel-diagram/src/test/java/org/apache/camel/diagram/DiagramDevConsoleTest.java index 0171181517930..681a48877ad1c 100644 --- a/components/camel-diagram/src/test/java/org/apache/camel/diagram/DiagramDevConsoleTest.java +++ b/components/camel-diagram/src/test/java/org/apache/camel/diagram/DiagramDevConsoleTest.java @@ -17,7 +17,6 @@ package org.apache.camel.diagram; import java.util.Base64; -import java.util.Map; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.console.DevConsole; @@ -74,16 +73,6 @@ void testTextOutputDefault() { assertThat(text).contains("data:image/png;base64,"); } - @Test - void testTextOutputTextTheme() { - DevConsole console = resolveConsole(); - String text = (String) console.call(DevConsole.MediaType.TEXT, Map.of(DiagramDevConsole.THEME, "text")); - assertThat(text).contains("Route: myRoute"); - assertThat(text).contains("Route: otherRoute"); - assertThat(text).contains("[from]"); - assertThat(text).contains("[choice]"); - } - @Test void testJsonOutput() { System.setProperty("java.awt.headless", "true"); diff --git a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json index 64c944a9d65a3..8cb1b1af58f7f 100644 --- a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json +++ b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json @@ -55,7 +55,7 @@ { "name": "camel.main.contextReloadEnabled", "required": false, "description": "Used for enabling context reloading. If enabled then Camel allow external systems such as security vaults (AWS secrets manager, etc.) to trigger refreshing Camel by updating property placeholders and reload all existing routes to take changes into effect.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": false, "secret": false }, { "name": "camel.main.description", "required": false, "description": "Sets the description (intended for humans) of the Camel application.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "string", "javaType": "java.lang.String", "secret": false }, { "name": "camel.main.devConsoleEnabled", "required": false, "description": "Whether to enable developer console (requires camel-console on classpath). The developer console is only for assisting during development. This is NOT for production usage.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": false, "secret": false, "security": "insecure:dev" }, - { "name": "camel.main.dumpRoutes", "required": false, "description": "If dumping is enabled then Camel will during startup dump all loaded routes (incl rests and route templates) represented as XML\/YAML DSL into the log. This is intended for trouble shooting or to assist during development. Sensitive information that may be configured in the route endpoints could potentially be included in the dump output and is therefore not recommended being used for production usage. This requires to have camel-xml-io\/camel-yaml-io on the classpath to be able to dump the routes as XML\/YAML. You can also use JSon which dumps the route structure in JSon. The JSon does not represent Camel DSL but it useful for tooling to understand the structure of the routes and how EIPs are nested together. You can also use png to save route diagrams as PNG image files either all combined in a single file (default camel-route-diagrams.png) or to a given folder, where routes are grouped by source file name(s) and saved as corresponding .png files.\\ This requires to have camel-diagram on the classpath to be able to render PNG diagrams.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "enum", "javaType": "java.lang.String", "secret": false, "enum": [ "xml", "yaml", "json", "png" ] }, + { "name": "camel.main.dumpRoutes", "required": false, "description": "If dumping is enabled then Camel will during startup dump all loaded routes (incl rests and route templates) represented as XML\/YAML DSL into the log. This is intended for trouble shooting or to assist during development. Sensitive information that may be configured in the route endpoints could potentially be included in the dump output and is therefore not recommended being used for production usage. This requires to have camel-xml-io\/camel-yaml-io on the classpath to be able to dump the routes as XML\/YAML. You can also use JSon which dumps the route structure in JSon. The JSon does not represent Camel DSL but it useful for tooling to understand the structure of the routes and how EIPs are nested together. You can also use png to save route diagrams as PNG image files either all combined in a single file (default camel-route-diagrams.png) or to a given folder, where routes are grouped by source file name(s) and saved as corresponding .png files. This requires to have camel-diagram on the classpath to be able to render PNG diagrams.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "enum", "javaType": "java.lang.String", "secret": false, "enum": [ "xml", "yaml", "json", "png" ] }, { "name": "camel.main.dumpRoutesGeneratedIds", "required": false, "description": "Whether to include auto generated IDs in the dumped output. Default is false.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": false, "secret": false }, { "name": "camel.main.dumpRoutesInclude", "required": false, "description": "Controls what to include in output for route dumping. Possible values: all, routes, rests, routeConfigurations, routeTemplates, beans, dataFormats. Multiple values can be separated by comma. Default is routes.", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "string", "javaType": "java.lang.String", "defaultValue": "routes", "secret": false }, { "name": "camel.main.dumpRoutesLog", "required": false, "description": "Whether to log route dumps to Logger", "sourceType": "org.apache.camel.main.DefaultConfigurationProperties", "type": "boolean", "javaType": "boolean", "defaultValue": true, "secret": false }, diff --git a/core/camel-main/src/main/docs/main.adoc b/core/camel-main/src/main/docs/main.adoc index cb17c720af877..aabcf2682df1b 100644 --- a/core/camel-main/src/main/docs/main.adoc +++ b/core/camel-main/src/main/docs/main.adoc @@ -49,7 +49,7 @@ The camel.main supports 131 options, which are listed below. | *camel.main.contextReloadEnabled* | Used for enabling context reloading. If enabled then Camel allow external systems such as security vaults (AWS secrets manager, etc.) to trigger refreshing Camel by updating property placeholders and reload all existing routes to take changes into effect. | false | boolean | *camel.main.description* | Sets the description (intended for humans) of the Camel application. | | String | *camel.main.devConsoleEnabled* | Whether to enable developer console (requires camel-console on classpath). The developer console is only for assisting during development. This is NOT for production usage. | false | boolean -| *camel.main.dumpRoutes* | If dumping is enabled then Camel will during startup dump all loaded routes (incl rests and route templates) represented as XML/YAML DSL into the log. This is intended for trouble shooting or to assist during development. Sensitive information that may be configured in the route endpoints could potentially be included in the dump output and is therefore not recommended being used for production usage. This requires to have camel-xml-io/camel-yaml-io on the classpath to be able to dump the routes as XML/YAML. You can also use JSon which dumps the route structure in JSon. The JSon does not represent Camel DSL but it useful for tooling to understand the structure of the routes and how EIPs are nested together. You can also use png to save route diagrams as PNG image files either all combined in a single file (default camel-route-diagrams.png) or to a given folder, where routes are grouped by source file name(s) and saved as corresponding .png files.\ This requires to have camel-diagram on the classpath to be able to render PNG diagrams. | | String +| *camel.main.dumpRoutes* | If dumping is enabled then Camel will during startup dump all loaded routes (incl rests and route templates) represented as XML/YAML DSL into the log. This is intended for trouble shooting or to assist during development. Sensitive information that may be configured in the route endpoints could potentially be included in the dump output and is therefore not recommended being used for production usage. This requires to have camel-xml-io/camel-yaml-io on the classpath to be able to dump the routes as XML/YAML. You can also use JSon which dumps the route structure in JSon. The JSon does not represent Camel DSL but it useful for tooling to understand the structure of the routes and how EIPs are nested together. You can also use png to save route diagrams as PNG image files either all combined in a single file (default camel-route-diagrams.png) or to a given folder, where routes are grouped by source file name(s) and saved as corresponding .png files. This requires to have camel-diagram on the classpath to be able to render PNG diagrams. | | String | *camel.main.dumpRoutesGeneratedIds* | Whether to include auto generated IDs in the dumped output. Default is false. | false | boolean | *camel.main.dumpRoutesInclude* | Controls what to include in output for route dumping. Possible values: all, routes, rests, routeConfigurations, routeTemplates, beans, dataFormats. Multiple values can be separated by comma. Default is routes. | routes | String | *camel.main.dumpRoutesLog* | Whether to log route dumps to Logger | true | boolean diff --git a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java index 33059fba3beec..966cb50486c9c 100644 --- a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java +++ b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationProperties.java @@ -1581,7 +1581,7 @@ public String getDumpRoutes() { * * You can also use png to save route diagrams as PNG image files either all combined in a single file (default * camel-route-diagrams.png) or to a given folder, where routes are grouped by source file name(s) and saved as - * corresponding .png files.\ This requires to have camel-diagram on the classpath to be able to render PNG + * corresponding .png files. This requires to have camel-diagram on the classpath to be able to render PNG * diagrams. */ public void setDumpRoutes(String dumpRoutes) { @@ -2814,7 +2814,7 @@ public T withExchangeFactoryStatisticsEnabled(boolean exchangeFactoryStatisticsE * * You can also use png to save route diagrams as PNG image files either all combined in a single file (default * camel-route-diagrams.png) or to a given folder, where routes are grouped by source file name(s) and saved as - * corresponding .png files.\ This requires to have camel-diagram on the classpath to be able to render PNG + * corresponding .png files. This requires to have camel-diagram on the classpath to be able to render PNG * diagrams. */ public T withDumpRoutes(String dumpRoutes) { diff --git a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-cmd-route-diagram.adoc b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-cmd-route-diagram.adoc index be9889a6c1cd0..d118b519b5c9d 100644 --- a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-cmd-route-diagram.adoc +++ b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-cmd-route-diagram.adoc @@ -26,7 +26,8 @@ camel cmd route-diagram [options] | `--metric` | Whether to include live metrics (only possible for running Camel application) | true | boolean | `--node-label` | What text to display in diagram nodes: code, description, or both (default) | both | String | `--output` | Save diagram to a PNG file instead of displaying in terminal | | String -| `--theme,--colors` | Color theme preset (dark, light, transparent, text) or custom colors (e.g. bg=#1e1e1e:from=#2e7d32:to=#1565c0). Values can be #hex or ANSI color names (e.g. from=seagreen:to=steelblue). Use bg= for transparent. Can also be set via DIAGRAM_COLORS env var. | dark | String +| `--theme` | Color theme preset (dark, light, transparent) or custom colors (e.g. bg=#1e1e1e:from=#2e7d32:to=#1565c0). Values can be #hex or ANSI color names (e.g. from=seagreen:to=steelblue). Use bg= for transparent. Can also be set via DIAGRAM_COLORS env var. | transparent | String +| `--watch` | Execute periodically and showing output fullscreen | | boolean | `--width` | Image width in pixels (0 = auto) | 0 | int | `-h,--help` | Display the help and sub-commands | | boolean |=== diff --git a/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json b/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json index 9e3f577faf42d..9e7a209d62c0d 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json +++ b/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json @@ -2,7 +2,7 @@ "commands": [ { "name": "bind", "fullName": "bind", "description": "DEPRECATED: Bind source and sink Kamelets as a new Camel integration", "deprecated": true, "sourceClass": "org.apache.camel.dsl.jbang.core.commands.bind.Bind", "options": [ { "names": "--error-handler", "description": "Add error handler (none|log|sink:). Sink endpoints are expected in the format [[apigroup\/]version:]kind:[namespace\/]name, plain Camel URIs or Kamelet name.", "javaType": "java.lang.String", "type": "string" }, { "names": "--output", "description": "Output format generated by this command (supports: file, yaml, json).", "defaultValue": "file", "javaType": "java.lang.String", "type": "string" }, { "names": "--property", "description": "Adds a pipe property in the form of [source|sink|error-handler|step-].= where is the step number starting from 1", "javaType": "java.lang.String", "type": "string" }, { "names": "--sink", "description": "Sink (to) such as a Kamelet or Camel endpoint uri", "javaType": "java.lang.String", "type": "string", "required": true }, { "names": "--source", "description": "Source (from) such as a Kamelet or Camel endpoint uri", "javaType": "java.lang.String", "type": "string", "required": true }, { "names": "--step", "description": "Optional steps such as a Kamelet or Camel endpoint uri", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "catalog", "fullName": "catalog", "description": "List artifacts from Camel Catalog", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.catalog.CatalogCommand", "options": [ { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ], "subcommands": [ { "name": "component", "fullName": "catalog component", "description": "List components from the Camel Catalog", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.catalog.CatalogComponent", "options": [ { "names": "--camel-version", "description": "To use a different Camel version than the default version", "javaType": "java.lang.String", "type": "string" }, { "names": "--display-gav", "description": "Display Maven GAV instead of name", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--download", "description": "Whether to allow automatic downloading JAR dependencies (over the internet)", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--filter", "description": "Filter by name or description", "javaType": "java.lang.String", "type": "string" }, { "names": "--json", "description": "Output in JSON Format", "javaType": "boolean", "type": "boolean" }, { "names": "--quarkus-group-id", "description": "Quarkus Platform Maven groupId", "defaultValue": "io.quarkus.platform", "javaType": "java.lang.String", "type": "string" }, { "names": "--quarkus-version", "description": "Quarkus Platform version", "defaultValue": "RuntimeType.QUARKUS_VERSION", "javaType": "java.lang.String", "type": "string" }, { "names": "--repo,--repos", "description": "Additional maven repositories for download on-demand (Use commas to separate multiple repositories)", "javaType": "java.lang.String", "type": "string" }, { "names": "--runtime", "description": "Runtime (camel-main, spring-boot, quarkus)", "javaType": "org.apache.camel.dsl.jbang.core.common.RuntimeType", "type": "object" }, { "names": "--since-after", "description": "Filter by version more recent (inclusive)", "javaType": "java.lang.String", "type": "string" }, { "names": "--since-before", "description": "Filter by version older (inclusive)", "javaType": "java.lang.String", "type": "string" }, { "names": "--sort", "description": "Sort by name, support-level, or description", "defaultValue": "name", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "dataformat", "fullName": "catalog dataformat", "description": "List data formats from the Camel Catalog", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.catalog.CatalogDataFormat", "options": [ { "names": "--camel-version", "description": "To use a different Camel version than the default version", "javaType": "java.lang.String", "type": "string" }, { "names": "--display-gav", "description": "Display Maven GAV instead of name", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--download", "description": "Whether to allow automatic downloading JAR dependencies (over the internet)", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--filter", "description": "Filter by name or description", "javaType": "java.lang.String", "type": "string" }, { "names": "--json", "description": "Output in JSON Format", "javaType": "boolean", "type": "boolean" }, { "names": "--quarkus-group-id", "description": "Quarkus Platform Maven groupId", "defaultValue": "io.quarkus.platform", "javaType": "java.lang.String", "type": "string" }, { "names": "--quarkus-version", "description": "Quarkus Platform version", "defaultValue": "RuntimeType.QUARKUS_VERSION", "javaType": "java.lang.String", "type": "string" }, { "names": "--repo,--repos", "description": "Additional maven repositories for download on-demand (Use commas to separate multiple repositories)", "javaType": "java.lang.String", "type": "string" }, { "names": "--runtime", "description": "Runtime (camel-main, spring-boot, quarkus)", "javaType": "org.apache.camel.dsl.jbang.core.common.RuntimeType", "type": "object" }, { "names": "--since-after", "description": "Filter by version more recent (inclusive)", "javaType": "java.lang.String", "type": "string" }, { "names": "--since-before", "description": "Filter by version older (inclusive)", "javaType": "java.lang.String", "type": "string" }, { "names": "--sort", "description": "Sort by name, support-level, or description", "defaultValue": "name", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "dev-console", "fullName": "catalog dev-console", "description": "List dev-consoles from the Camel Catalog", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.catalog.CatalogDevConsole", "options": [ { "names": "--camel-version", "description": "To use a different Camel version than the default version", "javaType": "java.lang.String", "type": "string" }, { "names": "--display-gav", "description": "Display Maven GAV instead of name", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--download", "description": "Whether to allow automatic downloading JAR dependencies (over the internet)", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--filter", "description": "Filter by name or description", "javaType": "java.lang.String", "type": "string" }, { "names": "--json", "description": "Output in JSON Format", "javaType": "boolean", "type": "boolean" }, { "names": "--quarkus-group-id", "description": "Quarkus Platform Maven groupId", "defaultValue": "io.quarkus.platform", "javaType": "java.lang.String", "type": "string" }, { "names": "--quarkus-version", "description": "Quarkus Platform version", "defaultValue": "RuntimeType.QUARKUS_VERSION", "javaType": "java.lang.String", "type": "string" }, { "names": "--repo,--repos", "description": "Additional maven repositories for download on-demand (Use commas to separate multiple repositories)", "javaType": "java.lang.String", "type": "string" }, { "names": "--runtime", "description": "Runtime (camel-main, spring-boot, quarkus)", "javaType": "org.apache.camel.dsl.jbang.core.common.RuntimeType", "type": "object" }, { "names": "--since-after", "description": "Filter by version more recent (inclusive)", "javaType": "java.lang.String", "type": "string" }, { "names": "--since-before", "description": "Filter by version older (inclusive)", "javaType": "java.lang.String", "type": "string" }, { "names": "--sort", "description": "Sort by name, support-level, or description", "defaultValue": "name", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "kamelet", "fullName": "catalog kamelet", "description": "List Kamelets from the Kamelet Catalog", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.catalog.CatalogKamelet", "options": [ { "names": "--filter", "description": "Filter by name or description", "javaType": "java.lang.String", "type": "string" }, { "names": "--kamelets-version", "description": "Apache Camel Kamelets version", "defaultValue": "RuntimeType.KAMELETS_VERSION", "javaType": "java.lang.String", "type": "string" }, { "names": "--sort", "description": "Sort by name, type, support-level, or description", "defaultValue": "name", "javaType": "java.lang.String", "type": "string" }, { "names": "--type,--filter-type", "description": "Filter by type: source, sink, or action", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "language", "fullName": "catalog language", "description": "List expression languages from the Camel Catalog", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.catalog.CatalogLanguage", "options": [ { "names": "--camel-version", "description": "To use a different Camel version than the default version", "javaType": "java.lang.String", "type": "string" }, { "names": "--display-gav", "description": "Display Maven GAV instead of name", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--download", "description": "Whether to allow automatic downloading JAR dependencies (over the internet)", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--filter", "description": "Filter by name or description", "javaType": "java.lang.String", "type": "string" }, { "names": "--json", "description": "Output in JSON Format", "javaType": "boolean", "type": "boolean" }, { "names": "--quarkus-group-id", "description": "Quarkus Platform Maven groupId", "defaultValue": "io.quarkus.platform", "javaType": "java.lang.String", "type": "string" }, { "names": "--quarkus-version", "description": "Quarkus Platform version", "defaultValue": "RuntimeType.QUARKUS_VERSION", "javaType": "java.lang.String", "type": "string" }, { "names": "--repo,--repos", "description": "Additional maven repositories for download on-demand (Use commas to separate multiple repositories)", "javaType": "java.lang.String", "type": "string" }, { "names": "--runtime", "description": "Runtime (camel-main, spring-boot, quarkus)", "javaType": "org.apache.camel.dsl.jbang.core.common.RuntimeType", "type": "object" }, { "names": "--since-after", "description": "Filter by version more recent (inclusive)", "javaType": "java.lang.String", "type": "string" }, { "names": "--since-before", "description": "Filter by version older (inclusive)", "javaType": "java.lang.String", "type": "string" }, { "names": "--sort", "description": "Sort by name, support-level, or description", "defaultValue": "name", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "other", "fullName": "catalog other", "description": "List miscellaneous components from the Camel Catalog", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.catalog.CatalogOther", "options": [ { "names": "--camel-version", "description": "To use a different Camel version than the default version", "javaType": "java.lang.String", "type": "string" }, { "names": "--display-gav", "description": "Display Maven GAV instead of name", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--download", "description": "Whether to allow automatic downloading JAR dependencies (over the internet)", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--filter", "description": "Filter by name or description", "javaType": "java.lang.String", "type": "string" }, { "names": "--json", "description": "Output in JSON Format", "javaType": "boolean", "type": "boolean" }, { "names": "--quarkus-group-id", "description": "Quarkus Platform Maven groupId", "defaultValue": "io.quarkus.platform", "javaType": "java.lang.String", "type": "string" }, { "names": "--quarkus-version", "description": "Quarkus Platform version", "defaultValue": "RuntimeType.QUARKUS_VERSION", "javaType": "java.lang.String", "type": "string" }, { "names": "--repo,--repos", "description": "Additional maven repositories for download on-demand (Use commas to separate multiple repositories)", "javaType": "java.lang.String", "type": "string" }, { "names": "--runtime", "description": "Runtime (camel-main, spring-boot, quarkus)", "javaType": "org.apache.camel.dsl.jbang.core.common.RuntimeType", "type": "object" }, { "names": "--since-after", "description": "Filter by version more recent (inclusive)", "javaType": "java.lang.String", "type": "string" }, { "names": "--since-before", "description": "Filter by version older (inclusive)", "javaType": "java.lang.String", "type": "string" }, { "names": "--sort", "description": "Sort by name, support-level, or description", "defaultValue": "name", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "transformer", "fullName": "catalog transformer", "description": "List data type transformers from the Camel Catalog", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.catalog.CatalogTransformer", "options": [ { "names": "--camel-version", "description": "To use a different Camel version than the default version", "javaType": "java.lang.String", "type": "string" }, { "names": "--display-gav", "description": "Display Maven GAV instead of name", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--download", "description": "Whether to allow automatic downloading JAR dependencies (over the internet)", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--filter", "description": "Filter by name or description", "javaType": "java.lang.String", "type": "string" }, { "names": "--json", "description": "Output in JSON Format", "javaType": "boolean", "type": "boolean" }, { "names": "--quarkus-group-id", "description": "Quarkus Platform Maven groupId", "defaultValue": "io.quarkus.platform", "javaType": "java.lang.String", "type": "string" }, { "names": "--quarkus-version", "description": "Quarkus Platform version", "defaultValue": "RuntimeType.QUARKUS_VERSION", "javaType": "java.lang.String", "type": "string" }, { "names": "--repo,--repos", "description": "Additional maven repositories for download on-demand (Use commas to separate multiple repositories)", "javaType": "java.lang.String", "type": "string" }, { "names": "--runtime", "description": "Runtime (camel-main, spring-boot, quarkus)", "javaType": "org.apache.camel.dsl.jbang.core.common.RuntimeType", "type": "object" }, { "names": "--since-after", "description": "Filter by version more recent (inclusive)", "javaType": "java.lang.String", "type": "string" }, { "names": "--since-before", "description": "Filter by version older (inclusive)", "javaType": "java.lang.String", "type": "string" }, { "names": "--sort", "description": "Sort by name, support-level, or description", "defaultValue": "name", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] } ] }, - { "name": "cmd", "fullName": "cmd", "description": "Performs commands in the running Camel integrations, such as start\/stop route, or change logging levels.", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelAction", "options": [ { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ], "subcommands": [ { "name": "browse", "fullName": "cmd browse", "description": "Browse pending messages on endpoints", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelBrowseAction", "options": [ { "names": "--body-max-chars", "description": "Maximum size of the message body to include in the dump", "javaType": "int", "type": "integer" }, { "names": "--dump", "description": "Whether to include message dumps", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--endpoint", "description": "Endpoint to browse messages from (can be uri, pattern, or refer to a route id)", "javaType": "java.lang.String", "type": "string" }, { "names": "--fresh-size", "description": "Whether to calculate fresh queue size information (performance overhead)", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--limit", "description": "Limits the number of messages to dump per endpoint", "defaultValue": "100", "javaType": "int", "type": "integer" }, { "names": "--logging-color", "description": "Use colored logging", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--mask", "description": "Whether to mask endpoint URIs to avoid printing sensitive information such as password or access keys", "javaType": "boolean", "type": "boolean" }, { "names": "--only-body", "description": "Show only message body in browsed messages", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--pretty", "description": "Pretty print message body when using JSon or XML format", "javaType": "boolean", "type": "boolean" }, { "names": "--short-uri", "description": "List endpoint URI without query parameters (short)", "javaType": "boolean", "type": "boolean" }, { "names": "--show-body", "description": "Show message body in browsed messages", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--show-headers", "description": "Show message headers in browsed messages", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--sort", "description": "Sort by uri, or size", "defaultValue": "uri", "javaType": "java.lang.String", "type": "string" }, { "names": "--tail", "description": "The number of messages from the end (latest) to dump", "javaType": "int", "type": "integer" }, { "names": "--wide-uri", "description": "List endpoint URI in full details", "javaType": "boolean", "type": "boolean" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "disable-processor", "fullName": "cmd disable-processor", "description": "Disable Camel processor", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelProcessorDisableAction", "options": [ { "names": "--id", "description": "Processor ids (multiple ids can be separated by comma)", "defaultValue": "*", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "enable-processor", "fullName": "cmd enable-processor", "description": "Enable Camel processor", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelProcessorEnableAction", "options": [ { "names": "--id", "description": "Processor ids (multiple ids can be separated by comma)", "defaultValue": "*", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "gc", "fullName": "cmd gc", "description": "Trigger Java Memory Garbage Collector", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelGCAction", "options": [ { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "load", "fullName": "cmd load", "description": "Loads new source files into an existing Camel", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelLoadAction", "options": [ { "names": "--restart", "description": "To force restart all routes after loading source files", "javaType": "boolean", "type": "boolean" }, { "names": "--source", "description": "Source file(s) to load", "javaType": "java.util.List", "type": "array" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "logger", "fullName": "cmd logger", "description": "List or change logging levels", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.LoggerAction", "options": [ { "names": "--logger", "description": "The logger name", "defaultValue": "root", "javaType": "java.lang.String", "type": "string" }, { "names": "--logging-level", "description": "To change logging level (ERROR, WARN, INFO, DEBUG, TRACE)", "javaType": "java.lang.String", "type": "string" }, { "names": "--sort", "description": "Sort by pid, name or age", "defaultValue": "pid", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "receive", "fullName": "cmd receive", "description": "Receive and dump messages from remote endpoints", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelReceiveAction", "options": [ { "names": "--action", "description": "Action to start, stop, clear, status, or dump messages", "defaultValue": "status", "javaType": "java.lang.String", "type": "string" }, { "names": "--compact", "description": "Compact output (no empty line separating messages)", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--endpoint,--uri", "description": "Endpoint to receive messages from (can be uri or pattern to refer to existing endpoint)", "javaType": "java.lang.String", "type": "string" }, { "names": "--find", "description": "Find and highlight matching text (ignore case).", "javaType": "java.lang.String", "type": "string" }, { "names": "--follow", "description": "Keep following and outputting new messages (press enter to exit).", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--grep", "description": "Filter messages to only output matching text (ignore case).", "javaType": "java.lang.String", "type": "string" }, { "names": "--logging-color", "description": "Use colored logging", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--mask", "description": "Whether to mask endpoint URIs to avoid printing sensitive information such as password or access keys", "javaType": "boolean", "type": "boolean" }, { "names": "--only-body", "description": "Show only message body in received messages", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--output", "description": "Output format (auto, true, false)", "javaType": "java.lang.String", "type": "string" }, { "names": "--prefix", "description": "Print prefix with running Camel integration name. auto=only prefix when running multiple integrations. true=always prefix. false=prefix off.", "defaultValue": "auto", "javaType": "java.lang.String", "type": "string" }, { "names": "--pretty", "description": "Pretty print message body when using JSon or XML format", "javaType": "boolean", "type": "boolean" }, { "names": "--prop,--property", "description": "Additional properties; override existing (only applicable when NOT using an existing running Camel)", "javaType": "java.lang.String", "type": "string" }, { "names": "--properties", "description": "comma separated list of properties file (only applicable when NOT using an existing running Camel) (ex. \/path\/to\/file.properties,\/path\/to\/other.properties", "javaType": "java.lang.String", "type": "string" }, { "names": "--short-uri", "description": "List endpoint URI without query parameters (short)", "javaType": "boolean", "type": "boolean" }, { "names": "--show-body", "description": "Show message body in received messages", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--show-exchange-properties", "description": "Show exchange properties in received messages", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--show-exchange-variables", "description": "Show exchange variables in received messages", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--show-headers", "description": "Show message headers in received messages", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--since", "description": "Return messages newer than a relative duration like 5s, 2m, or 1h. The value is in seconds if no unit specified.", "javaType": "java.lang.String", "type": "string" }, { "names": "--sort", "description": "Sort by pid, name or age for showing status of messages", "defaultValue": "pid", "javaType": "java.lang.String", "type": "string" }, { "names": "--tail", "description": "The number of messages from the end to show. Use -1 to read from the beginning. Use 0 to read only new lines. Defaults to showing all messages from beginning.", "defaultValue": "-1", "javaType": "int", "type": "integer" }, { "names": "--timeout", "description": "Timeout in millis waiting for message to be received", "defaultValue": "20000", "javaType": "long", "type": "integer" }, { "names": "--wide-uri", "description": "List endpoint URI in full details", "javaType": "boolean", "type": "boolean" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "reload", "fullName": "cmd reload", "description": "Trigger reloading Camel", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelReloadAction", "options": [ { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "reset-stats", "fullName": "cmd reset-stats", "description": "Reset performance statistics", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelResetStatsAction", "options": [ { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "resume-route", "fullName": "cmd resume-route", "description": "Resume Camel routes", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelRouteResumeAction", "options": [ { "names": "--id", "description": "Route ids (multiple ids can be separated by comma)", "defaultValue": "*", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "route-diagram", "fullName": "cmd route-diagram", "description": "Display Camel route diagram in the terminal", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelRouteDiagramAction", "options": [ { "names": "--box-width", "description": "Node box width in logical pixels", "defaultValue": "180", "javaType": "int", "type": "integer" }, { "names": "--filter", "description": "Filter route by filename or route id", "javaType": "java.lang.String", "type": "string" }, { "names": "--font-size", "description": "Font size in logical pixels for node text", "defaultValue": "12", "javaType": "int", "type": "integer" }, { "names": "--ignore-loading-error", "description": "Whether to ignore route loading and compilation errors (use this with care!)", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--metric", "description": "Whether to include live metrics (only possible for running Camel application)", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--node-label", "description": "What text to display in diagram nodes: code, description, or both (default)", "defaultValue": "both", "javaType": "java.lang.String", "type": "string" }, { "names": "--output", "description": "Save diagram to a PNG file instead of displaying in terminal", "javaType": "java.lang.String", "type": "string" }, { "names": "--theme,--colors", "description": "Color theme preset (dark, light, transparent, text) or custom colors (e.g. bg=#1e1e1e:from=#2e7d32:to=#1565c0). Values can be #hex or ANSI color names (e.g. from=seagreen:to=steelblue). Use bg= for transparent. Can also be set via DIAGRAM_COLORS env var.", "defaultValue": "dark", "javaType": "java.lang.String", "type": "string" }, { "names": "--width", "description": "Image width in pixels (0 = auto)", "defaultValue": "0", "javaType": "int", "type": "integer" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "route-structure", "fullName": "cmd route-structure", "description": "Dump Camel route structure", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelRouteStructureAction", "options": [ { "names": "--brief", "description": "To show less detailed route structure", "javaType": "boolean", "type": "boolean" }, { "names": "--description", "description": "To show description instead of code", "javaType": "boolean", "type": "boolean" }, { "names": "--filter", "description": "Filter route by filename or route id (multiple names can be separated by comma)", "javaType": "java.lang.String", "type": "string" }, { "names": "--ignore-loading-error", "description": "Whether to ignore route loading and compilation errors (use this with care!)", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--json", "description": "Output in JSON Format", "javaType": "boolean", "type": "boolean" }, { "names": "--raw", "description": "To output raw without metadata", "javaType": "boolean", "type": "boolean" }, { "names": "--sort", "description": "Sort route by name or id", "defaultValue": "name", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "send", "fullName": "cmd send", "description": "Send messages to endpoints", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelSendAction", "options": [ { "names": "--body", "description": "Message body to send (prefix with file: to refer to loading message body from file)", "javaType": "java.lang.String", "type": "string" }, { "names": "--endpoint,--uri", "description": "Endpoint where to send the message (can be uri, pattern, or refer to a route id)", "javaType": "java.lang.String", "type": "string" }, { "names": "--header", "description": "Message header (key=value)", "javaType": "java.util.List", "type": "array" }, { "names": "--infra", "description": "Send to infrastructure service (e.g., nats, kafka)", "javaType": "java.lang.String", "type": "string" }, { "names": "--logging-color", "description": "Use colored logging", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--poll", "description": "Poll instead of sending a message. This can be used to receive latest message from a Kafka topic or JMS queue.", "javaType": "boolean", "type": "boolean" }, { "names": "--pretty", "description": "Pretty print response message body (InOut) when using JSon or XML format", "javaType": "boolean", "type": "boolean" }, { "names": "--prop,--property", "description": "Additional properties; override existing (only applicable when NOT using an existing running Camel)", "javaType": "java.lang.String", "type": "string" }, { "names": "--properties", "description": "comma separated list of properties file (only applicable when NOT using an existing running Camel) (ex. \/path\/to\/file.properties,\/path\/to\/other.properties", "javaType": "java.lang.String", "type": "string" }, { "names": "--reply", "description": "Whether to expect a reply message (InOut vs InOut messaging style)", "javaType": "boolean", "type": "boolean" }, { "names": "--reply-file", "description": "Saves reply message to the file with the given name (override if exists)", "javaType": "java.lang.String", "type": "string" }, { "names": "--show-body", "description": "Show message body from response message (InOut)", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--show-exception", "description": "Show exception and stacktrace for failed messages", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--show-exchange-properties", "description": "Show exchange properties from response message (InOut)", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--show-exchange-variables", "description": "Show exchange variables from response message (InOut)", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--show-headers", "description": "Show message headers from response message (InOut)", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--timeout", "description": "Timeout in millis waiting for message to be sent (and reply message if InOut messaging)", "defaultValue": "20000", "javaType": "long", "type": "integer" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "start-group", "fullName": "cmd start-group", "description": "Start Camel route groups", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelRouteGroupStartAction", "options": [ { "names": "--id", "description": "Route ids (multiple ids can be separated by comma)", "defaultValue": "*", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "start-route", "fullName": "cmd start-route", "description": "Start Camel routes", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelRouteStartAction", "options": [ { "names": "--id", "description": "Route ids (multiple ids can be separated by comma)", "defaultValue": "*", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "stop-group", "fullName": "cmd stop-group", "description": "Stop Camel route groups", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelRouteGroupStopAction", "options": [ { "names": "--id", "description": "Route ids (multiple ids can be separated by comma)", "defaultValue": "*", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "stop-route", "fullName": "cmd stop-route", "description": "Stop Camel routes", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelRouteStopAction", "options": [ { "names": "--id", "description": "Route ids (multiple ids can be separated by comma)", "defaultValue": "*", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "stub", "fullName": "cmd stub", "description": "Browse stub endpoints", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelStubAction", "options": [ { "names": "--browse", "description": "Whether to browse messages queued in the stub endpoints", "javaType": "boolean", "type": "boolean" }, { "names": "--compact", "description": "Compact output (no empty line separating browsed messages)", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--filter", "description": "Filter endpoints by queue name", "javaType": "java.lang.String", "type": "string" }, { "names": "--find", "description": "Find and highlight matching text (ignore case).", "javaType": "java.lang.String", "type": "string" }, { "names": "--grep", "description": "Filter browsing messages to only output trace matching text (ignore case).", "javaType": "java.lang.String", "type": "string" }, { "names": "--limit", "description": "Filter browsing queues by limiting to the given latest number of messages", "defaultValue": "10", "javaType": "int", "type": "integer" }, { "names": "--logging-color", "description": "Use colored logging", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--mask", "description": "Whether to mask endpoint URIs to avoid printing sensitive information such as password or access keys", "javaType": "boolean", "type": "boolean" }, { "names": "--pretty", "description": "Pretty print message body when using JSon or XML format", "javaType": "boolean", "type": "boolean" }, { "names": "--show-body", "description": "Show message body in traced messages", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--show-headers", "description": "Show message headers in traced messages", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--sort", "description": "Sort by name, or total", "defaultValue": "name", "javaType": "java.lang.String", "type": "string" }, { "names": "--top", "description": "Whether to browse top (latest) messages queued in the stub endpoints", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--watch", "description": "Execute periodically and showing output fullscreen", "javaType": "boolean", "type": "boolean" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "suspend-route", "fullName": "cmd suspend-route", "description": "Suspend Camel routes", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelRouteSuspendAction", "options": [ { "names": "--id", "description": "Route ids (multiple ids can be separated by comma)", "defaultValue": "*", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "thread-dump", "fullName": "cmd thread-dump", "description": "List threads in a running Camel integration", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelThreadDump", "options": [ { "names": "--depth", "description": "Max depth of stack-trace", "defaultValue": "1", "javaType": "int", "type": "integer" }, { "names": "--filter", "description": "Filter thread names\/ids (use all to include all threads)", "defaultValue": "Camel", "javaType": "java.lang.String", "type": "string" }, { "names": "--sort", "description": "Sort by id, name or state", "defaultValue": "id", "javaType": "java.lang.String", "type": "string" }, { "names": "--state", "description": "To only show threads for a given state", "javaType": "java.lang.String", "type": "string" }, { "names": "--trace", "description": "Include stack-traces", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--watch", "description": "Execute periodically and showing output fullscreen", "javaType": "boolean", "type": "boolean" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] } ] }, + { "name": "cmd", "fullName": "cmd", "description": "Performs commands in the running Camel integrations, such as start\/stop route, or change logging levels.", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelAction", "options": [ { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ], "subcommands": [ { "name": "browse", "fullName": "cmd browse", "description": "Browse pending messages on endpoints", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelBrowseAction", "options": [ { "names": "--body-max-chars", "description": "Maximum size of the message body to include in the dump", "javaType": "int", "type": "integer" }, { "names": "--dump", "description": "Whether to include message dumps", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--endpoint", "description": "Endpoint to browse messages from (can be uri, pattern, or refer to a route id)", "javaType": "java.lang.String", "type": "string" }, { "names": "--fresh-size", "description": "Whether to calculate fresh queue size information (performance overhead)", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--limit", "description": "Limits the number of messages to dump per endpoint", "defaultValue": "100", "javaType": "int", "type": "integer" }, { "names": "--logging-color", "description": "Use colored logging", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--mask", "description": "Whether to mask endpoint URIs to avoid printing sensitive information such as password or access keys", "javaType": "boolean", "type": "boolean" }, { "names": "--only-body", "description": "Show only message body in browsed messages", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--pretty", "description": "Pretty print message body when using JSon or XML format", "javaType": "boolean", "type": "boolean" }, { "names": "--short-uri", "description": "List endpoint URI without query parameters (short)", "javaType": "boolean", "type": "boolean" }, { "names": "--show-body", "description": "Show message body in browsed messages", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--show-headers", "description": "Show message headers in browsed messages", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--sort", "description": "Sort by uri, or size", "defaultValue": "uri", "javaType": "java.lang.String", "type": "string" }, { "names": "--tail", "description": "The number of messages from the end (latest) to dump", "javaType": "int", "type": "integer" }, { "names": "--wide-uri", "description": "List endpoint URI in full details", "javaType": "boolean", "type": "boolean" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "disable-processor", "fullName": "cmd disable-processor", "description": "Disable Camel processor", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelProcessorDisableAction", "options": [ { "names": "--id", "description": "Processor ids (multiple ids can be separated by comma)", "defaultValue": "*", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "enable-processor", "fullName": "cmd enable-processor", "description": "Enable Camel processor", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelProcessorEnableAction", "options": [ { "names": "--id", "description": "Processor ids (multiple ids can be separated by comma)", "defaultValue": "*", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "gc", "fullName": "cmd gc", "description": "Trigger Java Memory Garbage Collector", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelGCAction", "options": [ { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "load", "fullName": "cmd load", "description": "Loads new source files into an existing Camel", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelLoadAction", "options": [ { "names": "--restart", "description": "To force restart all routes after loading source files", "javaType": "boolean", "type": "boolean" }, { "names": "--source", "description": "Source file(s) to load", "javaType": "java.util.List", "type": "array" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "logger", "fullName": "cmd logger", "description": "List or change logging levels", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.LoggerAction", "options": [ { "names": "--logger", "description": "The logger name", "defaultValue": "root", "javaType": "java.lang.String", "type": "string" }, { "names": "--logging-level", "description": "To change logging level (ERROR, WARN, INFO, DEBUG, TRACE)", "javaType": "java.lang.String", "type": "string" }, { "names": "--sort", "description": "Sort by pid, name or age", "defaultValue": "pid", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "receive", "fullName": "cmd receive", "description": "Receive and dump messages from remote endpoints", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelReceiveAction", "options": [ { "names": "--action", "description": "Action to start, stop, clear, status, or dump messages", "defaultValue": "status", "javaType": "java.lang.String", "type": "string" }, { "names": "--compact", "description": "Compact output (no empty line separating messages)", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--endpoint,--uri", "description": "Endpoint to receive messages from (can be uri or pattern to refer to existing endpoint)", "javaType": "java.lang.String", "type": "string" }, { "names": "--find", "description": "Find and highlight matching text (ignore case).", "javaType": "java.lang.String", "type": "string" }, { "names": "--follow", "description": "Keep following and outputting new messages (press enter to exit).", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--grep", "description": "Filter messages to only output matching text (ignore case).", "javaType": "java.lang.String", "type": "string" }, { "names": "--logging-color", "description": "Use colored logging", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--mask", "description": "Whether to mask endpoint URIs to avoid printing sensitive information such as password or access keys", "javaType": "boolean", "type": "boolean" }, { "names": "--only-body", "description": "Show only message body in received messages", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--output", "description": "Output format (auto, true, false)", "javaType": "java.lang.String", "type": "string" }, { "names": "--prefix", "description": "Print prefix with running Camel integration name. auto=only prefix when running multiple integrations. true=always prefix. false=prefix off.", "defaultValue": "auto", "javaType": "java.lang.String", "type": "string" }, { "names": "--pretty", "description": "Pretty print message body when using JSon or XML format", "javaType": "boolean", "type": "boolean" }, { "names": "--prop,--property", "description": "Additional properties; override existing (only applicable when NOT using an existing running Camel)", "javaType": "java.lang.String", "type": "string" }, { "names": "--properties", "description": "comma separated list of properties file (only applicable when NOT using an existing running Camel) (ex. \/path\/to\/file.properties,\/path\/to\/other.properties", "javaType": "java.lang.String", "type": "string" }, { "names": "--short-uri", "description": "List endpoint URI without query parameters (short)", "javaType": "boolean", "type": "boolean" }, { "names": "--show-body", "description": "Show message body in received messages", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--show-exchange-properties", "description": "Show exchange properties in received messages", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--show-exchange-variables", "description": "Show exchange variables in received messages", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--show-headers", "description": "Show message headers in received messages", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--since", "description": "Return messages newer than a relative duration like 5s, 2m, or 1h. The value is in seconds if no unit specified.", "javaType": "java.lang.String", "type": "string" }, { "names": "--sort", "description": "Sort by pid, name or age for showing status of messages", "defaultValue": "pid", "javaType": "java.lang.String", "type": "string" }, { "names": "--tail", "description": "The number of messages from the end to show. Use -1 to read from the beginning. Use 0 to read only new lines. Defaults to showing all messages from beginning.", "defaultValue": "-1", "javaType": "int", "type": "integer" }, { "names": "--timeout", "description": "Timeout in millis waiting for message to be received", "defaultValue": "20000", "javaType": "long", "type": "integer" }, { "names": "--wide-uri", "description": "List endpoint URI in full details", "javaType": "boolean", "type": "boolean" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "reload", "fullName": "cmd reload", "description": "Trigger reloading Camel", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelReloadAction", "options": [ { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "reset-stats", "fullName": "cmd reset-stats", "description": "Reset performance statistics", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelResetStatsAction", "options": [ { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "resume-route", "fullName": "cmd resume-route", "description": "Resume Camel routes", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelRouteResumeAction", "options": [ { "names": "--id", "description": "Route ids (multiple ids can be separated by comma)", "defaultValue": "*", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "route-diagram", "fullName": "cmd route-diagram", "description": "Display Camel route diagram in the terminal", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelRouteDiagramAction", "options": [ { "names": "--box-width", "description": "Node box width in logical pixels", "defaultValue": "180", "javaType": "int", "type": "integer" }, { "names": "--filter", "description": "Filter route by filename or route id", "javaType": "java.lang.String", "type": "string" }, { "names": "--font-size", "description": "Font size in logical pixels for node text", "defaultValue": "12", "javaType": "int", "type": "integer" }, { "names": "--ignore-loading-error", "description": "Whether to ignore route loading and compilation errors (use this with care!)", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--metric", "description": "Whether to include live metrics (only possible for running Camel application)", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--node-label", "description": "What text to display in diagram nodes: code, description, or both (default)", "defaultValue": "both", "javaType": "java.lang.String", "type": "string" }, { "names": "--output", "description": "Save diagram to a PNG file instead of displaying in terminal", "javaType": "java.lang.String", "type": "string" }, { "names": "--theme", "description": "Color theme preset (dark, light, transparent) or custom colors (e.g. bg=#1e1e1e:from=#2e7d32:to=#1565c0). Values can be #hex or ANSI color names (e.g. from=seagreen:to=steelblue). Use bg= for transparent. Can also be set via DIAGRAM_COLORS env var.", "defaultValue": "transparent", "javaType": "java.lang.String", "type": "string" }, { "names": "--watch", "description": "Execute periodically and showing output fullscreen", "javaType": "boolean", "type": "boolean" }, { "names": "--width", "description": "Image width in pixels (0 = auto)", "defaultValue": "0", "javaType": "int", "type": "integer" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "route-structure", "fullName": "cmd route-structure", "description": "Dump Camel route structure", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelRouteStructureAction", "options": [ { "names": "--brief", "description": "To show less detailed route structure", "javaType": "boolean", "type": "boolean" }, { "names": "--description", "description": "To show description instead of code", "javaType": "boolean", "type": "boolean" }, { "names": "--filter", "description": "Filter route by filename or route id (multiple names can be separated by comma)", "javaType": "java.lang.String", "type": "string" }, { "names": "--ignore-loading-error", "description": "Whether to ignore route loading and compilation errors (use this with care!)", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--json", "description": "Output in JSON Format", "javaType": "boolean", "type": "boolean" }, { "names": "--raw", "description": "To output raw without metadata", "javaType": "boolean", "type": "boolean" }, { "names": "--sort", "description": "Sort route by name or id", "defaultValue": "name", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "send", "fullName": "cmd send", "description": "Send messages to endpoints", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelSendAction", "options": [ { "names": "--body", "description": "Message body to send (prefix with file: to refer to loading message body from file)", "javaType": "java.lang.String", "type": "string" }, { "names": "--endpoint,--uri", "description": "Endpoint where to send the message (can be uri, pattern, or refer to a route id)", "javaType": "java.lang.String", "type": "string" }, { "names": "--header", "description": "Message header (key=value)", "javaType": "java.util.List", "type": "array" }, { "names": "--infra", "description": "Send to infrastructure service (e.g., nats, kafka)", "javaType": "java.lang.String", "type": "string" }, { "names": "--logging-color", "description": "Use colored logging", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--poll", "description": "Poll instead of sending a message. This can be used to receive latest message from a Kafka topic or JMS queue.", "javaType": "boolean", "type": "boolean" }, { "names": "--pretty", "description": "Pretty print response message body (InOut) when using JSon or XML format", "javaType": "boolean", "type": "boolean" }, { "names": "--prop,--property", "description": "Additional properties; override existing (only applicable when NOT using an existing running Camel)", "javaType": "java.lang.String", "type": "string" }, { "names": "--properties", "description": "comma separated list of properties file (only applicable when NOT using an existing running Camel) (ex. \/path\/to\/file.properties,\/path\/to\/other.properties", "javaType": "java.lang.String", "type": "string" }, { "names": "--reply", "description": "Whether to expect a reply message (InOut vs InOut messaging style)", "javaType": "boolean", "type": "boolean" }, { "names": "--reply-file", "description": "Saves reply message to the file with the given name (override if exists)", "javaType": "java.lang.String", "type": "string" }, { "names": "--show-body", "description": "Show message body from response message (InOut)", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--show-exception", "description": "Show exception and stacktrace for failed messages", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--show-exchange-properties", "description": "Show exchange properties from response message (InOut)", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--show-exchange-variables", "description": "Show exchange variables from response message (InOut)", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--show-headers", "description": "Show message headers from response message (InOut)", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--timeout", "description": "Timeout in millis waiting for message to be sent (and reply message if InOut messaging)", "defaultValue": "20000", "javaType": "long", "type": "integer" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "start-group", "fullName": "cmd start-group", "description": "Start Camel route groups", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelRouteGroupStartAction", "options": [ { "names": "--id", "description": "Route ids (multiple ids can be separated by comma)", "defaultValue": "*", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "start-route", "fullName": "cmd start-route", "description": "Start Camel routes", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelRouteStartAction", "options": [ { "names": "--id", "description": "Route ids (multiple ids can be separated by comma)", "defaultValue": "*", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "stop-group", "fullName": "cmd stop-group", "description": "Stop Camel route groups", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelRouteGroupStopAction", "options": [ { "names": "--id", "description": "Route ids (multiple ids can be separated by comma)", "defaultValue": "*", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "stop-route", "fullName": "cmd stop-route", "description": "Stop Camel routes", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelRouteStopAction", "options": [ { "names": "--id", "description": "Route ids (multiple ids can be separated by comma)", "defaultValue": "*", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "stub", "fullName": "cmd stub", "description": "Browse stub endpoints", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelStubAction", "options": [ { "names": "--browse", "description": "Whether to browse messages queued in the stub endpoints", "javaType": "boolean", "type": "boolean" }, { "names": "--compact", "description": "Compact output (no empty line separating browsed messages)", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--filter", "description": "Filter endpoints by queue name", "javaType": "java.lang.String", "type": "string" }, { "names": "--find", "description": "Find and highlight matching text (ignore case).", "javaType": "java.lang.String", "type": "string" }, { "names": "--grep", "description": "Filter browsing messages to only output trace matching text (ignore case).", "javaType": "java.lang.String", "type": "string" }, { "names": "--limit", "description": "Filter browsing queues by limiting to the given latest number of messages", "defaultValue": "10", "javaType": "int", "type": "integer" }, { "names": "--logging-color", "description": "Use colored logging", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--mask", "description": "Whether to mask endpoint URIs to avoid printing sensitive information such as password or access keys", "javaType": "boolean", "type": "boolean" }, { "names": "--pretty", "description": "Pretty print message body when using JSon or XML format", "javaType": "boolean", "type": "boolean" }, { "names": "--show-body", "description": "Show message body in traced messages", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--show-headers", "description": "Show message headers in traced messages", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--sort", "description": "Sort by name, or total", "defaultValue": "name", "javaType": "java.lang.String", "type": "string" }, { "names": "--top", "description": "Whether to browse top (latest) messages queued in the stub endpoints", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--watch", "description": "Execute periodically and showing output fullscreen", "javaType": "boolean", "type": "boolean" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "suspend-route", "fullName": "cmd suspend-route", "description": "Suspend Camel routes", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelRouteSuspendAction", "options": [ { "names": "--id", "description": "Route ids (multiple ids can be separated by comma)", "defaultValue": "*", "javaType": "java.lang.String", "type": "string" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "thread-dump", "fullName": "cmd thread-dump", "description": "List threads in a running Camel integration", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.action.CamelThreadDump", "options": [ { "names": "--depth", "description": "Max depth of stack-trace", "defaultValue": "1", "javaType": "int", "type": "integer" }, { "names": "--filter", "description": "Filter thread names\/ids (use all to include all threads)", "defaultValue": "Camel", "javaType": "java.lang.String", "type": "string" }, { "names": "--sort", "description": "Sort by id, name or state", "defaultValue": "id", "javaType": "java.lang.String", "type": "string" }, { "names": "--state", "description": "To only show threads for a given state", "javaType": "java.lang.String", "type": "string" }, { "names": "--trace", "description": "Include stack-traces", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--watch", "description": "Execute periodically and showing output fullscreen", "javaType": "boolean", "type": "boolean" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] } ] }, { "name": "completion", "fullName": "completion", "description": "Generate completion script for bash\/zsh", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Complete", "options": [ { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "config", "fullName": "config", "description": "Get and set user configuration values", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.config.ConfigCommand", "options": [ { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ], "subcommands": [ { "name": "get", "fullName": "config get", "description": "Display user configuration value", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.config.ConfigGet", "options": [ { "names": "--global", "description": "Use global or local configuration", "javaType": "boolean", "type": "boolean" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "list", "fullName": "config list", "description": "Displays user configuration", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.config.ConfigList", "options": [ { "names": "--global", "description": "Use global or local configuration", "javaType": "boolean", "type": "boolean" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "set", "fullName": "config set", "description": "Set user configuration value", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.config.ConfigSet", "options": [ { "names": "--global", "description": "Use global or local configuration", "javaType": "boolean", "type": "boolean" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, { "name": "unset", "fullName": "config unset", "description": "Remove user configuration value", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.config.ConfigUnset", "options": [ { "names": "--global", "description": "Use global or local configurations", "javaType": "boolean", "type": "boolean" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] } ] }, { "name": "debug", "fullName": "debug", "description": "Debug local Camel integration", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Debug", "options": [ { "names": "--ago", "description": "Use ago instead of yyyy-MM-dd HH:mm:ss in timestamp.", "javaType": "boolean", "type": "boolean" }, { "names": "--background", "description": "Run in the background", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--background-wait", "description": "To wait for run in background to startup successfully, before returning", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--backlog-trace", "description": "Enables backlog tracing of the routed messages", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--breakpoint", "description": "To set breakpoint at the given node id (Multiple ids can be separated by comma). If no breakpoint is set, then the first route is automatic selected.", "javaType": "java.lang.String", "type": "string" }, { "names": "--camel-spring-boot-version", "description": "To run using a different Camel Spring Boot version than the default version.", "javaType": "java.lang.String", "type": "string" }, { "names": "--camel-version", "description": "To run using a different Camel version than the default version.", "javaType": "java.lang.String", "type": "string" }, { "names": "--code", "description": "Run the given text or file as Java DSL routes", "javaType": "java.lang.String", "type": "string" }, { "names": "--console", "description": "Developer console at \/q\/dev on local HTTP server (port 8080 by default)", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--dep,--dependency", "description": "Add additional dependencies", "javaType": "java.util.List", "type": "array" }, { "names": "--download", "description": "Whether to allow automatic downloading JAR dependencies (over the internet)", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--empty", "description": "Run an empty Camel without loading source files", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--exclude", "description": "Exclude files by name or pattern", "javaType": "java.util.List", "type": "array" }, { "names": "--fresh", "description": "Make sure we use fresh (i.e. non-cached) resources", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--gav", "description": "The Maven group:artifact:version (used during exporting)", "javaType": "java.lang.String", "type": "string" }, { "names": "--health", "description": "Deprecated: use --observe instead. Health check at \/q\/health on local HTTP server (port 8080 by default)", "defaultValue": "false", "javaType": "boolean", "type": "boolean", "deprecated": true }, { "names": "--ignore-loading-error", "description": "Whether to ignore route loading and compilation errors (use this with care!)", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--java-version,--java", "description": "Java version (21, 25)", "defaultValue": "21", "javaType": "java.lang.String", "type": "string" }, { "names": "--jfr", "description": "Enables Java Flight Recorder saving recording to disk on exit", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--jfr-profile", "description": "Java Flight Recorder profile to use (such as default or profile)", "javaType": "java.lang.String", "type": "string" }, { "names": "--jvm-debug", "description": "To enable JVM remote debugging on port 4004 by default. The supported values are true to enable the remote debugging, false to disable the remote debugging or a number to use a custom port", "javaType": "int", "type": "integer", "paramLabel": "" }, { "names": "--kamelets-version", "description": "Apache Camel Kamelets version", "javaType": "java.lang.String", "type": "string" }, { "names": "--lazy-bean", "description": "Whether to use lazy bean initialization (can help with complex classloading issues)", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--local-kamelet-dir", "description": "Local directory (or github link) for loading Kamelets (takes precedence). Multiple directories can be specified separated by comma.", "javaType": "java.lang.String", "type": "string" }, { "names": "--log-lines", "description": "Number of log lines to display on top of screen", "defaultValue": "10", "javaType": "int", "type": "integer" }, { "names": "--logging", "description": "Can be used to turn off logging", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--logging-category", "description": "Used for individual logging levels (ex: org.apache.kafka=DEBUG)", "javaType": "java.util.List", "type": "array" }, { "names": "--logging-color", "description": "Use colored logging. Default is auto-detected based on NO_COLOR, CI, FORCE_COLOR environment variables and terminal capabilities", "javaType": "boolean", "type": "boolean" }, { "names": "--logging-config-path", "description": "Path to file with custom logging configuration", "javaType": "java.lang.String", "type": "string" }, { "names": "--logging-json", "description": "Use JSON logging (ECS Layout)", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--logging-level", "description": "Logging level (ERROR, WARN, INFO, DEBUG, TRACE)", "defaultValue": "info", "javaType": "java.lang.String", "type": "string" }, { "names": "--management-port", "description": "To use a dedicated port for HTTP management (use 0 to dynamic assign a free random port number)", "javaType": "int", "type": "integer" }, { "names": "--mask", "description": "Whether to mask endpoint URIs to avoid printing sensitive information such as password or access keys", "javaType": "boolean", "type": "boolean" }, { "names": "--maven-apache-snapshot-enabled", "description": "Whether downloading JARs from ASF Maven Snapshot repository is enabled", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--maven-central-enabled", "description": "Whether downloading JARs from Maven Central repository is enabled", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--maven-settings", "description": "Optional location of Maven settings.xml file to configure servers, repositories, mirrors and proxies. If set to false, not even the default ~\/.m2\/settings.xml will be used.", "javaType": "java.lang.String", "type": "string" }, { "names": "--maven-settings-security", "description": "Optional location of Maven settings-security.xml file to decrypt settings.xml", "javaType": "java.lang.String", "type": "string" }, { "names": "--max-idle-seconds", "description": "For how long time in seconds Camel can be idle before stopping", "defaultValue": "0", "javaType": "int", "type": "integer" }, { "names": "--max-messages", "description": "Max number of messages to process before stopping", "defaultValue": "0", "javaType": "int", "type": "integer" }, { "names": "--max-seconds", "description": "Max seconds to run before stopping", "defaultValue": "0", "javaType": "int", "type": "integer" }, { "names": "--metrics", "description": "Deprecated: use --observe instead. Metrics (Micrometer and Prometheus) at \/q\/metrics on local HTTP server (port 8080 by default)", "defaultValue": "false", "javaType": "boolean", "type": "boolean", "deprecated": true }, { "names": "--modeline", "description": "Whether to support JBang style \/\/DEPS to specify additional dependencies", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--name", "description": "The name of the Camel application", "defaultValue": "CamelJBang", "javaType": "java.lang.String", "type": "string" }, { "names": "--observe", "description": "Enable observability services", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--open-api", "description": "Adds an OpenAPI spec from the given file (json or yaml file)", "javaType": "java.lang.String", "type": "string" }, { "names": "--output", "description": "File to store the current message body (will override). This allows for manual inspecting the message later.", "javaType": "java.lang.String", "type": "string" }, { "names": "--package-scan-jars", "description": "Whether to automatic package scan JARs for custom Spring or Quarkus beans making them available for Camel JBang", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--port", "description": "Embeds a local HTTP server on this port (port 8080 by default; use 0 to dynamic assign a free random port number)", "javaType": "int", "type": "integer" }, { "names": "--pretty", "description": "Pretty print message body when using JSon or XML format", "javaType": "boolean", "type": "boolean" }, { "names": "--profile", "description": "Profile to run (dev, test, prod).", "defaultValue": "dev", "javaType": "java.lang.String", "type": "string" }, { "names": "--prompt", "description": "Allow user to type in required parameters in prompt if not present in application", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--prop,--property", "description": "Additional properties (override existing)", "javaType": "java.lang.String", "type": "string" }, { "names": "--properties", "description": "comma separated list of properties file (ex. \/path\/to\/file.properties,\/path\/to\/other.properties", "javaType": "java.lang.String", "type": "string" }, { "names": "--quarkus-artifact-id", "description": "Quarkus Platform Maven artifactId", "defaultValue": "quarkus-bom", "javaType": "java.lang.String", "type": "string" }, { "names": "--quarkus-group-id", "description": "Quarkus Platform Maven groupId", "defaultValue": "io.quarkus.platform", "javaType": "java.lang.String", "type": "string" }, { "names": "--quarkus-version", "description": "Quarkus Platform version", "defaultValue": "RuntimeType.QUARKUS_VERSION", "javaType": "java.lang.String", "type": "string" }, { "names": "--reload,--dev", "description": "Enables dev mode (live reload when source files are updated and saved)", "javaType": "boolean", "type": "boolean" }, { "names": "--remote-attach", "description": "Attaches debugger remotely to an existing running Camel integration. (Add camel-cli-debug JAR to the existing Camel application and run before attaching this debugger)", "javaType": "boolean", "type": "boolean" }, { "names": "--repo,--repos", "description": "Additional maven repositories (Use commas to separate multiple repositories)", "javaType": "java.lang.String", "type": "string" }, { "names": "--runtime", "description": "Runtime (camel-main, spring-boot, quarkus)", "defaultValue": "camel-main", "javaType": "org.apache.camel.dsl.jbang.core.common.RuntimeType", "type": "object" }, { "names": "--show-body", "description": "Show message body in debug messages", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--show-exception", "description": "Show exception and stacktrace for failed messages", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--show-exchange-properties", "description": "Show exchange properties in debug messages", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--show-exchange-variables", "description": "Show exchange variables in debug messages", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--show-headers", "description": "Show message headers in debug messages", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--skip-plugins", "description": "Skip resolving plugin dependencies", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--source", "description": "Prefer to display source filename\/code instead of IDs", "javaType": "boolean", "type": "boolean" }, { "names": "--source-dir", "description": "Source directory for dynamically loading Camel file(s) to run. When using this, then files cannot be specified at the same time.", "javaType": "java.lang.String", "type": "string" }, { "names": "--spring-boot-version", "description": "Spring Boot version", "defaultValue": "RuntimeType.SPRING_BOOT_VERSION", "javaType": "java.lang.String", "type": "string" }, { "names": "--stop-on-exit", "description": "Whether to stop the running Camel on exit", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--stub", "description": "Stubs all the matching endpoint uri with the given component name or pattern. Multiple names can be separated by comma. (all = stub all endpoints).", "javaType": "java.lang.String", "type": "string" }, { "names": "--timestamp", "description": "Print timestamp.", "defaultValue": "true", "javaType": "boolean", "type": "boolean" }, { "names": "--trace", "description": "Enables trace logging of the routed messages", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "--verbose", "description": "Verbose output of startup activity (dependency resolution and downloading", "defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": "-h,--help", "description": "Display the help and sub-commands", "javaType": "boolean", "type": "boolean" } ] }, diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/ActionWatchCommand.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/ActionWatchCommand.java index 976a356c2337f..5bc634eed4dd6 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/ActionWatchCommand.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/ActionWatchCommand.java @@ -31,7 +31,8 @@ abstract class ActionWatchCommand extends ActionBaseCommand { description = "Execute periodically and showing output fullscreen") boolean watch; - private CommandHelper.ReadConsoleTask waitUserTask; + private Runnable waitUserTask; + final AtomicBoolean running = new AtomicBoolean(true); protected ActionWatchCommand(CamelJBangMain main) { super(main); @@ -43,7 +44,7 @@ public Integer doCall() throws Exception { final AtomicBoolean running = new AtomicBoolean(true); if (watch) { Thread t = new Thread(() -> { - waitUserTask = new CommandHelper.ReadConsoleTask(() -> running.set(false)); + waitUserTask = waitForUserEnter(); waitUserTask.run(); }, "WaitForUser"); t.start(); @@ -53,7 +54,7 @@ public Integer doCall() throws Exception { // use 2-sec delay in watch mode try { StopWatch watch = new StopWatch(); - while (running.get() && watch.taken() < 2000) { + while (running.get() && watchWait(watch)) { Thread.sleep(100); } } catch (Exception e) { @@ -67,10 +68,18 @@ public Integer doCall() throws Exception { return exit; } + protected Runnable waitForUserEnter() { + return new CommandHelper.ReadConsoleTask(() -> running.set(false)); + } + protected void clearScreen() { AnsiConsole.out().print(Ansi.ansi().eraseScreen().cursor(1, 1)); } + protected boolean watchWait(StopWatch watch) { + return watch.taken() < 2000; + } + protected abstract Integer doWatchCall() throws Exception; } diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelRouteDiagramAction.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelRouteDiagramAction.java index c4989bfc8485e..d79fdc876a10d 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelRouteDiagramAction.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelRouteDiagramAction.java @@ -23,7 +23,6 @@ import java.nio.file.Path; import java.util.ArrayList; import java.util.List; -import java.util.Optional; import javax.imageio.ImageIO; @@ -41,17 +40,21 @@ import org.apache.camel.dsl.jbang.core.common.PathUtils; import org.apache.camel.main.KameletMain; import org.apache.camel.support.PatternHelper; +import org.apache.camel.util.StopWatch; import org.apache.camel.util.json.JsonObject; +import org.jline.reader.LineReader; +import org.jline.reader.LineReaderBuilder; import org.jline.terminal.Terminal; import org.jline.terminal.TerminalBuilder; import org.jline.terminal.impl.TerminalGraphics; import org.jline.terminal.impl.TerminalGraphicsManager; +import org.jline.utils.InfoCmp; import picocli.CommandLine; import picocli.CommandLine.Command; @Command(name = "route-diagram", description = "Display Camel route diagram in the terminal", sortOptions = false, showDefaultValues = true) -public class CamelRouteDiagramAction extends ActionBaseCommand { +public class CamelRouteDiagramAction extends ActionWatchCommand { @CommandLine.Parameters(description = "Source file name, or name/pid of a running Camel integration", arity = "0..1") String name = "*"; @@ -68,12 +71,12 @@ public class CamelRouteDiagramAction extends ActionBaseCommand { description = "Save diagram to a PNG file instead of displaying in terminal") String output; - @CommandLine.Option(names = { "--theme", "--colors" }, - description = "Color theme preset (dark, light, transparent, text) or custom colors " + @CommandLine.Option(names = { "--theme" }, + description = "Color theme preset (dark, light, transparent) or custom colors " + "(e.g. bg=#1e1e1e:from=#2e7d32:to=#1565c0). Values can be #hex or " + "ANSI color names (e.g. from=seagreen:to=steelblue). " + "Use bg= for transparent. Can also be set via DIAGRAM_COLORS env var.", - defaultValue = "dark") + defaultValue = "transparent") String theme; @CommandLine.Option(names = { "--font-size" }, @@ -99,6 +102,11 @@ public class CamelRouteDiagramAction extends ActionBaseCommand { private volatile long pid; + private DiagramColors colors; + private Terminal terminal; + private TerminalGraphics terminalGraphics; + private LineReader lineReader; + public CamelRouteDiagramAction(CamelJBangMain main) { super(main); } @@ -107,9 +115,25 @@ public CamelRouteDiagramAction(CamelJBangMain main) { public Integer doCall() throws Exception { System.setProperty("java.awt.headless", "true"); - String colorSpec = System.getenv("DIAGRAM_COLORS"); - DiagramColors colors = !"text".equals(theme) ? DiagramColors.parse(colorSpec != null ? colorSpec : theme) : null; + // if output in terminal then ensure terminal supports this + if (output == null) { + String colorSpec = System.getenv("DIAGRAM_COLORS"); + colors = DiagramColors.parse(colorSpec != null ? colorSpec : theme); + terminal = TerminalBuilder.builder().system(true).build(); + terminalGraphics = TerminalGraphicsManager.getBestProtocol(terminal).orElse(null); + if (terminalGraphics == null) { + printer().println("Terminal does not support graphics protocols (Kitty, iTerm2, or Sixel)."); + printer().println("Try running in a supported terminal: Kitty, iTerm2, WezTerm, Ghostty, or VS Code."); + return 1; + } + lineReader = LineReaderBuilder.builder().terminal(terminal).build(); + } + return super.doCall(); + } + + @Override + protected Integer doWatchCall() throws Exception { Path outputFile; int exit = 0; List pids = findPids(name); @@ -143,7 +167,7 @@ public Integer doCall() throws Exception { List routes = parseRoutes(jo); if (routes.isEmpty()) { printer().println("No routes found"); - return 0; + return 1; } if (filter != null) { @@ -155,7 +179,7 @@ public Integer doCall() throws Exception { if (routes.isEmpty()) { printer().println("No routes match filter: " + filter); - return 0; + return 1; } NodeLabelMode labelMode = parseNodeLabelMode(nodeLabel); @@ -164,13 +188,6 @@ public Integer doCall() throws Exception { engine.getNodeWidth(), fontSize * RouteDiagramLayoutEngine.SCALE, engine.getNodeTextPadding(), pid > 0 && metric); - if ("text".equals(theme)) { - for (String line : renderer.printTextDiagram(routes, labelMode)) { - printer().println(line); - } - return 0; - } - List layoutRoutes = new ArrayList<>(); int currentY = RouteDiagramLayoutEngine.PADDING; for (RouteInfo route : routes) { @@ -196,35 +213,10 @@ public Integer doCall() throws Exception { ImageIO.write(image, "PNG", file); printer().println("Diagram saved to: " + file.getAbsolutePath()); } else { - try (Terminal terminal = TerminalBuilder.builder().system(true).build()) { - try { - Optional protocol = TerminalGraphicsManager.getBestProtocol(terminal); - if (protocol.isPresent()) { - TerminalGraphics.ImageOptions opts = new TerminalGraphics.ImageOptions() - .preserveAspectRatio(true); - if (width > 0) { - opts.width(width); - } - protocol.get().displayImage(terminal, image, opts); - terminal.writer().println(); - terminal.flush(); - } else { - printer().println( - "Terminal does not support graphics protocols (Kitty, iTerm2, or Sixel)."); - printer().println( - "Try running in a supported terminal: Kitty, iTerm2, WezTerm, Ghostty, or VS Code."); - for (String line : renderer.printTextDiagram(routes, labelMode)) { - printer().println(line); - } - } - } catch (IOException | UnsupportedOperationException e) { - printer().println("Failed to display diagram in terminal: " + e.getMessage()); - printer().println("Falling back to text diagram."); - for (String line : renderer.printTextDiagram(routes, labelMode)) { - printer().println(line); - } - } + if (watch) { + clearScreen(); } + doDisplayDiagram(image); } return 0; @@ -233,6 +225,43 @@ public Integer doCall() throws Exception { } } + @Override + protected boolean watchWait(StopWatch watch) { + return watch.taken() < 5000; + } + + @Override + protected void clearScreen() { + if (terminal != null) { + terminal.puts(InfoCmp.Capability.clear_screen); + terminal.flush(); + } + } + + @Override + protected Runnable waitForUserEnter() { + return () -> { + if (lineReader != null) { + try { + lineReader.readLine(); + } catch (Exception e) { + // ignore + } + } + }; + } + + private void doDisplayDiagram(BufferedImage image) throws IOException { + TerminalGraphics.ImageOptions opts = new TerminalGraphics.ImageOptions() + .preserveAspectRatio(true); + if (width > 0) { + opts.width(width); + } + terminalGraphics.displayImage(terminal, image, opts); + terminal.writer().println(); + terminal.flush(); + } + private void doCallPid(Long pid) { this.pid = pid;