[ 
https://issues.apache.org/jira/browse/CAMEL-26929?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18145252#comment-18145252
 ] 

Claus Ibsen commented on CAMEL-26929:
-------------------------------------

Merged to main for 4.24.0:
- [#30020|https://github.com/apache/camel/pull/30020] camel get transformer no 
longer warns for each integration without transformers (201f79792464)
- [#30029|https://github.com/apache/camel/pull/30029] camel cmd send and the 
trace dump have --json (d9f3fa093994)

Open for 4.24.0:
- [#30027|https://github.com/apache/camel/pull/30027] camel stop without a name 
stops none when several integrations run, unless --all
- [#30028|https://github.com/apache/camel/pull/30028] the trace file starts 
again at 10 MB, and camel trace and the TUI follow the new file

Left for 4.25: item 5, the name of an integration is its file name in some 
commands and its short name in others (the name also finds the log files, and 
both work as a name).

_Claude Code on behalf of Claus Ibsen (davsclaus)_

> camel-jbang - camel get, cmd and stop: get consumer and get producer fail, an 
> exact name also matches longer names, and cmd send without a name sends 
> nothing
> -------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-26929
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26929
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jbang
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 4.24.0
>
>
> Found by a scan of the Camel CLI on 2026-11-13, with the unpacked 
> 4.24.0-SNAPSHOT camel-launcher on macOS (JDK 25). *(exp)* means reproduced by 
> experiment, *(read)* means traced in the code. Paths are relative to 
> {{dsl/camel-jbang/}}, and line numbers are from main at that time. Earlier 
> findings of this kind: CAMEL-26901, CAMEL-26911 to CAMEL-26914.
> h3. 1. camel get consumer and camel get producer fail with exit 70 on any 
> integration with a consumer (exp, high)
> {{ListConsumer.java:105}} and {{ListProducer.java:100}} (camel-jbang-core 
> {{commands/process}}) read the key {{class}}, but since CAMEL-24565 (released 
> in 4.23.0) the consoles are records and the key is {{clazz}} 
> ({{ConsumerDevConsole.java:66}}, {{ProducerDevConsole.java:40}}). {{getType}} 
> then calls {{endsWith}} on null:
> {noformat}
> $ camel get consumer --json
> {"status":"error","code":70,"message":"Cannot invoke 
> \"String.endsWith(String)\" because \"s\" is null"}
> {noformat}
> {{ListConsumer:106}} also reads {{hostedService}}, while the key is 
> {{hosted}}. The TUI was fixed ({{StatusParser.java:473,555}}), the CLI was 
> not. The tests pass because {{ListConsumerTest:129}} writes the old key by 
> hand: build the fixtures from the console records so a renamed key breaks a 
> test.
> h3. 2. An exact name also matches longer names, and camel stop stops them all 
> (exp, high)
> {{ProcessFinder.pattern()}} (lines 247-254) treats a name as a prefix unless 
> it ends with {{!}}. With {{orders}} and {{orders-v2}} running, every 
> single-integration command for {{orders}} fails with exit 3, and {{camel stop 
> orders}} stops both (also logger, reset-stats, stop-route, trace). The error 
> message does not mention {{orders!}}. When exactly one name equals the given 
> name, take it.
> h3. 3. camel cmd send without a name sends nothing and reports success (exp, 
> high)
> Without a name {{CamelSendAction}} (lines 209-214) starts an empty local 
> Camel. With no {{--endpoint}} it prints {{Sent (success)}} and exits 0 
> ({{SendDevConsole.findTarget}} returns null, lines 157-159 and 288-294). 
> {{camel-jbang-tips.adoc:89}} recommends exactly this command for {{--stub}}. 
> With {{--endpoint=direct:x --reply}} it waits 30 s (33.7 s measured) against 
> the CLI's own empty Camel and exits 124. A missing target should be an error, 
> and an internal endpoint ({{direct:}}, {{seda:}}, {{stub:}}) without a name 
> should use the one running integration or list them. Without a name, receive, 
> send and the chaos commands also pick their target by three different rules.
> h3. 4. Options that are silently ignored (exp)
> * {{cmd route-structure --json}} ignores {{--filter}}, {{--sort}}, 
> {{--brief}} and {{--description}}, and exits 0 for a filter that matches 
> nothing ({{CamelRouteStructureAction.java:136,154-157}}); the text output and 
> route-dump handle them.
> * {{cmd logger --logging-level=BOGUS}} sets the logger to ERROR and exits 0 
> ({{LoggerAction.java:85-91}}); without a name it does it to every integration.
> * {{cmd send --timeout}} only bounds how long the CLI waits, not the send 
> ({{SendDevConsole.java:144-146,270-281}}): {{direct:nope}} ends in a CLI 
> timeout (exit 124) instead of "No consumers available". A timeout below 5000 
> is raised to 5000 without a word.
> * {{cmd receive --since}} never filters: the message timestamp is 0 for most 
> components ({{ReceiveDevConsole.java:294-296}}); fall back to the exchange 
> creation time. {{--action=status --output=json}} prints the table, the JSON 
> stream starts with "Starting to receive..." on stdout, {{--action=stop}} 
> prints "Starting to receive...", and a start with an endpoint that matches 
> nothing exits 0.
> * {{cmd browse --endpoint=seda:foo}}, the example in its own help, never 
> matches; only {{seda://foo}} does ({{BrowseDevConsole.java:123,176}}).
> h3. 5. JSON and output (exp)
> * {{uptime}} is a start timestamp in most commands but a duration in 
> {{CamelRouteStatus.java:147-148}} and {{CamelRouteGroupStatus.java:119-120}}, 
> so {{--sort=age}} sorts the opposite way in {{get route}}.
> * {{pid}} is a string in trace status, browse, stub, logger and get about, 
> and a number elsewhere; {{name}} is the file name in the action commands and 
> the short name in the listings.
> * {{get error}}, {{get history}} and {{top source}} JSON rows have no pid or 
> name; {{get about --json}} is an object for one integration and an array for 
> several.
> * ANSI escape codes in piped output of {{cmd send --reply}}, {{trace 
> --action=dump}} and {{cmd browse --dump}} ({{MessageTableHelper}}, 
> {{--logging-color}} defaults to true). #29826 fixes {{camel log}} only.
> * {{cmd send}} and the trace dump have no {{--json}}.
> h3. 6. The trace file grows without limit (exp)
> {{<pid>-trace.json}} grows while tracing is on 
> ({{FileCliConnectorTransport.java:398-417}}): 758 KB after 10 minutes of a 2 
> s timer, about 15 MB a minute at 100 exchanges/s. 
> {{CamelTraceAction.tailTraceFiles}} reads the whole file for every 
> {{--tail}}. Cap or rotate it, and read the tail from the end.
> h3. 7. Smaller
> * {{get transformer}} warns with an NPE for every integration without 
> transformers ({{ListTransformer.java:70-71}}); 
> {{ProcessBaseCommand.forEachIntegration}} turns CLI bugs like this into 
> warnings.
> * With nothing running, single-integration commands say "No running Camel 
> integration matches: *" and exit 3; an ambiguous name is exit 3 here and exit 
> 2 for chaos.
> * {{cmd send}} to an integration with several routes and no {{--endpoint}} 
> takes the first route, which may be a timer.
> * {{camel stop}} with no name stops every integration without asking when 
> there is no terminal. During the scan one agent's bare stop stopped the 
> integrations of other agents. Consider requiring {{*}} or {{--all}} when more 
> than one runs.
> * Bare {{camel get}} and {{camel top}} have no {{--json}}; {{camel ps}} has 
> no name filter.
> h3. Came out clean
> CAMEL-26911 items 3 and 4 (trace/receive clear, torn replies) are fixed on 
> main. Not-found handling (exit 3 plus a JSON error), {{--sort}} validation, 
> {{--watch}} without a terminal, route control, {{cmd load}}, {{gc}} and 
> {{camel restart}} work, and every option in the 75 documented example lines 
> exists.
> _Claude Code on behalf of Claus Ibsen_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to