davsclaus opened a new pull request, #29914: URL: https://github.com/apache/camel/pull/29914
Item 3 of [CAMEL-26929](https://issues.apache.org/jira/browse/CAMEL-26929). ## Problem Without a name, `camel cmd send` started an empty Camel of its own (no routes) and sent from there: - **No `--endpoint`:** `SendDevConsole.findTarget` found no route, so nothing was sent, yet it reported `Sent (success)` and exit 0. `camel-jbang-tips.adoc` recommends exactly this command after `camel run myroute.java --stub=jms`. - **An endpoint only an integration has** (`direct:`, `seda:`, `stub:`, a route id): the CLI's own Camel has no consumer for it. With `--reply` the CLI waited 30 s and exited 124. On the launcher from main, with an integration running whose first route is `direct:orders`: ``` $ camel cmd send --body=hello-main ... : Sent (success) (0ms) # exit 0; the integration's log has no "got hello-main" ``` ## Change - **Without a name,** `camel cmd send` sends to the integration that runs when there is no `--endpoint` (its first route, as with a name) or when the endpoint is one only an integration has (`direct`, `seda`, `stub`, `disruptor`, `disruptor-vm`, `mock`, `dataset`, `vm`, a route id or a pattern). - With no integration running, it exits 3: "No running Camel integration to send to: start one with camel run, or give --endpoint to send to a system such as kafka:topic". - With several running, it exits 3 and lists them. - **An endpoint of a system outside the integrations** (`kafka:`, `jms:`, `paho-mqtt5:`, `kamelet:`, ...) is still sent from the CLI's own Camel, as before. - **`SendDevConsole` (camel-console):** a send without an endpoint to a Camel without routes is now an error ("No endpoint to send to: give the endpoint, as there are no routes"), not reported as sent. This also helps CLIs of other versions. - **Docs:** the help of the name argument, "Sending without a running integration" in `camel-jbang-devtools.adoc`, and the 4.24 upgrade guide. After, on the same integration: ``` $ camel cmd send --body=hello-fix ... direct://orders : Sent (success) (1ms) # the integration logs "got hello-fix" $ camel cmd send --endpoint=direct:orders --body=hello-direct ... direct://orders : Sent (success) (0ms) # the integration logs "got hello-direct" $ camel stop <pid>; camel cmd send --body=x ERROR: No running Camel integration to send to: start one with camel run, or give --endpoint to send to a system such as kafka:topic # exit 3 ``` ## Tests - `CamelSendActionTest`: without a name, to the one integration (no endpoint, and `direct:`). Refused with none running, and with two running (nothing sent). Which endpoints count as inside an integration. - `SendDevConsoleNoRoutesTest`: a send without an endpoint and without routes is an error, in JSON and text. - End to end with the launcher, as above. - `CliHelpGoldenTest`: the golden help has the new text of the name argument. - camel-console: 292 tests pass. camel-jbang-core: 3003 pass (`DependencyUpdateTest` failed once and passed on the rerun, as on other branches). _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
