davsclaus opened a new pull request, #29523: URL: https://github.com/apache/camel/pull/29523
[CAMEL-26795](https://issues.apache.org/jira/browse/CAMEL-26795): a chaos experiment feeds a route that starts from `file:<folder>` by sending to that endpoint. The file producer writes each message as a file into the folder the route polls. I tried it live: that works for a plain `file:inbox`. But the files are named by the exchange id, so a route with a filter such as `include=.*\.json` skipped every one of them. The experiment then FAILed with "0 completed", as if the route had lost them: a **false finding**. Live, before and after, on a route `from: file:invoices?include=.*\.json&delete=true`: ``` before: Experiment 2 FAIL every invoice is read (r2, ended after 16s) expect invoices:5: unmet, 0 completed after: Experiment 1 PASS every invoice is read (r1, ended after 3s) expect invoices:5: met, 5 completed traffic: 5 messages sent to file://invoices?delete=true&include=.*%5C.json in 451ms (the route logged chaos-1794263372900-1.json ... -5.json) ``` Changes: - **`ChaosExperimentRun.fileName`**: a feed to a file route gets a `CamelFileName` of `chaos-<time>.<ext>`. - The extension comes from the route's `include` or `antInclude` filter (the options decoded, as the status has them URL-encoded), else from the body (json, xml, the extension of a `file:` body, txt). - It is not added when the feed names its files itself (`--header CamelFileName=...`), or when the route reads one file (`fileName=`). - **`RepeatedSend`** (camel-cli-connector): a repeated send, or a folder, **numbers a `CamelFileName` header per message**: `order.json` becomes `order-1.json`, `order-2.json`. A file endpoint then writes one file per message instead of overwriting one. This applies to `camel cmd send --repeat` too, and is documented in camel-jbang-devtools. - **Docs and playbook**: the managing docs say how a file route is fed, and the playbook no longer says file routes cannot be fed. Tests: `ChaosExperimentRunTest` (`theFilesOfAFileFeedPassTheFilterOfTheRoute`, `aFileRouteIsFedWithNamedFiles`) and `LocalCliConnectorSendActionTest.aRepeatedFileNameIsNumbered`. 569 chaos, tool, golden and help tests of camel-jbang-core are green, and the connector send tests are green. **Stacked on #29521** (CAMEL-26793). Retarget to main once that merges. _Claude Code on behalf of Claus Ibsen_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_012nJsFsjqqFiwroeHRWaKbS -- 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]
