davsclaus opened a new pull request, #138: URL: https://github.com/apache/camel-jbang-examples/pull/138
A new example on the `route` rung: the payment provider sends the shop a settlement file a day, one CSV line per payment. The route reads each file line by line with a streaming split, logs the payments of 500 EUR or more, appends a line it cannot read to `rejects/` and goes on, and logs a summary when a file is done. **What it teaches** - `split` with the `tokenize` language and `streaming: true` (one line at a time), with `skipFirst` for the header line. - The CSV data format on each line, with `header` and `useMaps`. - The amount converted to a `BigDecimal` before the filter compares it. As text, `"1633.36" >= "500"` is false. - `doTry` and `doCatch` around a line: the two lines whose amount is not a number (`N/A`, and `1O.50` with the letter O) go to `rejects/settlement-2026-11-10.csv`, and the file still ends in `inbox/done`. - `CamelSplitComplete` and `CamelSplitSize` on the last line for the summary. With streaming, the size is only known at the end. **Files** - `samples/` holds the two files, 5000 payments each. The `provider` route copies them into `inbox/`, as `connect/file-processing` does, so a run does not change the committed files. - `rejects/` is added to `.gitignore`, like the other runtime folders. `inbox/` is ignored already. - The test (`test/batch-file.citrus.it.yaml`) checks a large payment, a rejected line and a summary. It is added to `build.yml`. - `generate-catalog.sh` refreshed the catalog and the README tables. **Checked** - `camel validate yaml --canonical` reports nothing. - `camel test run route/batch-file/test` passes with Camel 4.23.0, the version CI uses, and with 4.24.0-SNAPSHOT. - The "Try changing" items were run: without the `doTry` the second file ends in `inbox/failed`; with `stopOnException: true` it stops at the first bad line. Closes #137 _Claude Code on behalf of Claus Ibsen_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_016Y4dDi5iQNgtHrDdz2NpwF -- 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]
