allthingssecurity opened a new pull request, #28539: URL: https://github.com/apache/camel/pull/28539
# Description [CAMEL-26330](https://issues.apache.org/jira/browse/CAMEL-26330) A short design document for camel-chaos, as asked on the JIRA: `design/chaos.adoc`, in the format of the other design documents (and of `design/payload-mode.adoc` in #28457). The code follows in its own pull requests, in the order the document lists. What the document proposes, in short: - **Switched on by the classpath.** A `ContextServicePlugin` adds the hooks when the JAR is present; they stay idle until a rule is added. With profile `prod`, or `camel.chaos.enabled=false`, nothing is installed. The plugin reads the profile and the options when the context initializes, as camel-main sets them after the plugins are loaded. - **`camel.chaos.*` options** through camel-main (`enabled`, `seed`, `rules` at startup, `maxDuration`, `reportOnShutdown`). Rules are added, changed and removed live, and end by themselves. - **Hooks at all levels**, following the table on CAMEL-26330: - sends: the send hook of camel-core ([CAMEL-26331](https://issues.apache.org/jira/browse/CAMEL-26331)), so the components stay the real ones and the routes get no extra processors; - the messages that enter a route: a `RoutePolicy` from a `RoutePolicyFactory`; - consumer polls: the poll strategy of a `ScheduledPollConsumer` (`setPollStrategy`); - every step: a hook in the channel (`CamelInternalProcessor`), next to the `camel cmd disable-processor` check, in a follow-up ticket; - the route lifecycle: the `RouteController`, and `removeRoute` with the definition added again. So chaos needs two small camel-core changes, the send hook and the step hook; the rest uses SPIs that exist today. - **A typed failure** where it matters, such as the HTTP exception with a status code and headers, so the route's `onException` is tested. - **Time**: real time by default, so a person sees the faults; the same rules in virtual time inside a camel-test-dst world, through `TimeSource`. The document records that camel-chaos may use `TimeSource` (it never installs a provider). - **A report per route** from an event notifier, with expectations and a verdict that does not call a redelivered message lost. - **Control** through a `chaos` dev console (used by the CLI connector for `camel cmd chaos`), and a `chaos` runtime tool group of the camel-jbang MCP server, offered only when the application has camel-chaos. - Wrapping the component (as `camel run --stub` does), an event notifier, `interceptSendToEndpoint` and an `InterceptStrategy` are listed as alternatives, with the reason each was not chosen. - Custom fault types, and the prototype's video, models and scripts, are not part of it. It is about 14 KB and only about Camel. AGENTS.md lists it with the other design documents (the line sits above the Java DSL one, so it does not conflict with the line #28457 adds). Open questions at the end of the document: the module location, whether chaos should also stay off when no profile is set, and the text form of rules in `application.properties`. # Target - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch) # Tracking - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it): [CAMEL-26330](https://issues.apache.org/jira/browse/CAMEL-26330). # Apache Camel coding standards and style - [x] I checked that each commit in the pull request has a meaningful subject line and body. - [ ] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes. (Documentation only: `design/chaos.adoc` and one line in `AGENTS.md`; nothing is generated from them.) # AI-assisted contributions - [x] If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR description identifies the AI tool used. This PR was prepared with Claude Code (Claude Opus 5.5). The commit carries a `Co-Authored-By` trailer. _Claude Code on behalf of allthingssecurity_ 🤖 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]
