CAMEL-23683 add camel-shell component#23750
Conversation
davsclaus
left a comment
There was a problem hiding this comment.
Cool idea — an interactive terminal component that routes user input to any Camel endpoint. The code is clean and well-structured. A few items to address before merge.
Version numbers: The component uses 4.19.0-SNAPSHOT / firstVersion = "4.19.0" / :since: 4.19, but the current SNAPSHOT is 4.21.0-SNAPSHOT. All should be updated to 4.21.
Tests: Per project conventions, every PR must include tests for new functionality. While the interactive terminal nature makes full integration testing harder, at minimum the component lifecycle, endpoint configuration, and pure functions like resolveColor() can be unit-tested.
Observations (non-blocking):
terminal.puts(InfoCmp.Capability.clear_screen)indoStart()clears the user's terminal on startup — could be surprising. Consider making this opt-in.getCamelContext().stop()in the consumer'sfinallyblock means EOF/exit shuts down the entire Camel context. Worth documenting explicitly — users might not expect Ctrl+D to stop their application.Category.APIin@UriEndpointdoesn't seem fitting for a terminal component.- The "shell" name might conflict with the OS shell concept or the existing
camel shellJBang command. Users might expectshell:to execute OS commands. Considerconsole:orterminal:— though this is a design choice.
This review does not replace specialized AI review tools (CodeRabbit, Sourcery) or static analysis (SonarCloud).
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
| import org.jline.reader.LineReader; | ||
| import org.jline.terminal.Terminal; | ||
|
|
||
| @UriEndpoint(firstVersion = "4.19.0", category = { Category.API }, scheme = "shell", title = "Shell", |
There was a problem hiding this comment.
firstVersion should be 4.21.0 (current SNAPSHOT is 4.21.0-SNAPSHOT, not 4.19.0-SNAPSHOT).
| @UriEndpoint(firstVersion = "4.19.0", category = { Category.API }, scheme = "shell", title = "Shell", | |
| @UriEndpoint(firstVersion = "4.21.0", category = { Category.API }, scheme = "shell", title = "Shell", |
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
davsclaus
left a comment
There was a problem hiding this comment.
Thanks for fixing the version numbers — all 4.21 now. Two remaining items:
CI failure: The full reactor build generates additional files that aren't committed (EndpointBuilderFactory, camel-component-known-dependencies.properties, etc.). Please run mvn clean install -DskipTests from the repository root and commit all auto-generated changes.
Tests: Still missing. Per project conventions, new functionality should include tests. While the interactive terminal makes integration testing harder, unit tests for component lifecycle, endpoint configuration, and resolveColor() are feasible.
This review does not replace specialized AI review tools (CodeRabbit, Sourcery) or static analysis (SonarCloud).
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
davsclaus
left a comment
There was a problem hiding this comment.
Thanks for adding the tests and fixing the version numbers — good progress! A couple of items still need attention.
1. Missing configureConsumer(consumer) in ShellEndpoint.createConsumer() — Without this call, bridgeErrorHandler, exceptionHandler, and exchangePattern are advertised as endpoint options but have no effect. This is the standard Camel pattern used by every consumer-supporting component (see e.g. camel-iggy, camel-telegram).
2. CI failure — "Fail if there are uncommitted changes" is still failing. Please run mvn clean install -DskipTests from the repository root and commit all auto-generated file changes.
3. remote: true should be false — This is a local terminal component (reads from stdin), not a remote one. Comparable local components (camel-seda, camel-exec, camel-direct) all use "remote": false.
This review does not replace specialized AI review tools (CodeRabbit, Sourcery) or static analysis (SonarCloud).
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
gnodet
left a comment
There was a problem hiding this comment.
Nice new camel-shell component using JLine. The implementation is clean and follows Camel component conventions well:
- ShellComponent: Manages JLine terminal lifecycle, banner display, and LineReader creation
- ShellConsumer: Read loop that sends each line as an exchange body and prints the response
- ShellEndpoint: Consumer-only endpoint with
promptandcolorparameters - Good test coverage: component registration, endpoint creation, color resolution, producer rejection
The component is consumer-only (as expected for an interactive shell), properly handles EOF and exit commands, and shuts down the CamelContext when the shell exits. Documentation includes practical examples (LLM chat, REST API, JMS fire-and-forget).
Fully automatic review from Claude Code
|
@johnpoth can you fix the findings and update this PR |
|
🧪 CI tested the following changed modules:
✅ POM dependency changes: targeted tests included Changed managed dependencies: org.apache.camel:camel-shell Modules affected by dependency changes (10)
Build reactor — dependencies compiled but only changed modules were tested (12 modules)
|
|
Thanks @davsclaus and @gnodet for reviewing! Merged... maybe this should look more like the TUI we have in the CLI in the future... we'll see, thanks ! |
Description
https://issues.apache.org/jira/browse/CAMEL-23683
I think it would be cool to have a small camel-shell component that communicates with other camel endpoints so far example:
This would start the Java Camel process in "shell" mode and route user typed messages to the Qwen model. The idea would be valid for any camel endpoints.
Also maybe add a camel-command component in the future to have some runtime commands (fetch metrics etc..)
Here are some GIFS of what it looks like, let me know what you think !
Target
mainbranch)Tracking
Apache Camel coding standards and style
mvn clean install -DskipTestslocally from root folder and I have committed all auto-generated changes.