Claus Ibsen created CAMEL-25865:
-----------------------------------
Summary: camel-jbang - the tools and the Simple docs say how to
read a data file: constant with resource:file:, and load() under camel run
Key: CAMEL-25865
URL: https://issues.apache.org/jira/browse/CAMEL-25865
Project: Camel
Issue Type: Improvement
Components: camel-jbang, camel-core
Reporter: Claus Ibsen
Fix For: 4.24.0
A route that needs a data file, such as a lookup table (stock.json), reads it
with the constant language: {{resource:file:stock.json}}, for example in a
{{setVariable}}. That recipe is only on the page of the constant language. The
tools point elsewhere:
* {{camel_catalog_doc file}} says "to consume one message in the middle of a
route use the poll EIP (poll: {uri: ...}), or pollEnrich";
* a consumer option on a {{to: file:...}} (such as fileName with noop) gets "to
read from an endpoint in the middle of a route use the poll EIP, or pollEnrich".
The poll EIP consumes the file (it is moved away without noop), which is not
what a lookup needs.
The Simple docs say that {{load()}} "can only load from classpath; and not the
file-system". That is so, but with Camel JBang, {{camel run}} puts the files of
the project on the classpath ("Additional files added to classpath: ..."), so
{{${load(stock.json)}}} reads a stock.json next to the routes. The docs do not
say it.
Found in a benchmark of Oct 19-20 2026: in a JMS example, 7 of 12 runs tried to
load stock.json and failed; no run opened the constant page.
Proposal:
* For the file component, both hints add: to read a data file the route needs,
such as a lookup table, use the constant language with resource:file: (such as
setVariable with constant: resource:file:stock.json). Other components keep
their hint.
* The Simple docs say that camel run puts the files of the project on the
classpath, and point to resource:file: of the constant language to read a file
of the file system in any runtime.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)