Claus Ibsen created CAMEL-24839:
-----------------------------------

             Summary: camel-file: a file endpoint whose directory is an 
existing regular file starts and stays silent; fail with a message (and flag it 
in camel validate)
                 Key: CAMEL-24839
                 URL: https://issues.apache.org/jira/browse/CAMEL-24839
             Project: Camel
          Issue Type: Improvement
          Components: camel-jbang, camel-file
            Reporter: Claus Ibsen


A route that names a file where the file component expects a directory starts 
without a word and never delivers anything:

{code:yaml}
- route:
    from:
      uri: "file:order.json?noop=true"
      steps:
        - log: "READ ${header.CamelFileName}"
{code}

{{Started route1 (file://order.json)}} and then silence. The same with 
{{pollEnrich}} on {{file://.//order.json}}: the body comes back null after the 
timeout. {{order.json}} exists next to the route as a regular file, so the 
consumer polls a "directory" that is a file and finds no entries.

Two improvements:

# At startup (or on the first poll), when the configured directory exists and 
is a regular file, fail with a message that says what to write: "order.json is 
a file, not a directory: to read one file use file:.?fileName=order.json (or 
poll it with pollEnrich)". Today the check in {{FileConsumer.pollDirectory}} 
only logs at DEBUG that the directory does not exist or is not a directory, and 
{{directoryMustExist}} is off by default.
# {{camel validate yaml}} sees the project directory, so it can flag a file: 
endpoint (in from:, to:, poll: or pollEnrich) whose directory part is an 
existing regular file, with the same hint.

Found in the round-2 local-model benchmark on the camel-jbang-examples ladder 
(json-transform): the model wanted to read order.json next to the route, wrote 
the file name as the endpoint path, and got no output and no message for two 
attempts. A person new to the file component writes exactly this.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to